Your response is not correct.  If p is null, then there is no object, so
there is no equals() method to call.  You'll get NullPointerException if
you try to execute your example and p is null.

Jay

-----Original Message-----
From: Poornima Visvesvaran [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 04, 2001 7:00 AM
To: [EMAIL PROTECTED]
Subject: Re: Simple Problem....


Hi,

instead of if(p!=null),

use

if(!(p.equals(null))
{}

It will work.

Poornima Visvesvaran.
--- "Artigas, Ricardo Y." <[EMAIL PROTECTED]> wrote:
 > Maybe the value of parameter "ID" is spaces.
 >
 > :^)
 > Ricky Y. Artigas
 > Analyst/Programmer
 > Information Technology Division
 > Easycall Communications Phils., Inc.
 > - Easycall Internet -
 > 418 Arayat St., Mandaluyong City 1550, Philippines
 > Personal WAP Site:
 > http://www.buzzed.co.uk/mobile/?rya
 > Company Website: http://www.easycall.com.ph
 > Tel.no: (+632) 5338001 ext.6574
 > Mobile:(+63) 0917-8951783
 > Pager:  141-002955
 > Email: [EMAIL PROTECTED]
 >
 >
 > > -------------------------------
 > > IMPORTANT NOTICE:
 >
 > > This message (and any attachment hereto) may
 > contain privileged and/or
 > > confidential information specific to EasyCall. If
 > you are not the intended
 > > addressee indicated in this message, you may not
 > copy or disseminate this
 > > message (or any attachment hereto) to anyone.
 > Instead, please destroy this
 > > message (and any attachment hereto), and kindly
 > notify the sender by reply
 > > email. Any information in this message (and any
 > attachment thereto) that
 > > do not relate to the official business of EasyCall
 > shall be understood as
 > > neither given nor endorsed by the company.
 > >
 > >
 > > -----Original Message-----
 > > From: irene_plj asiamail.com
 > [SMTP:[EMAIL PROTECTED]]
 > > Sent: Wednesday, April 04, 2001 10:57 AM
 > > To:   [EMAIL PROTECTED]
 > > Subject:      Simple Problem....
 > >
 > > Hi all ,
 > >
 > > The problem wf the below code(part of my
 > servlet)is i always get the "if"
 > > condition even if it "p" equals null..
 > > Wat could be wrong???
 > > This is such a simple problem but i jus cannot get
 > the "else" condition
 > > when p==null.
 > > Anyone any idea why this cannot work??
 > > Thks .
 > >
 > > ******************************************
 > > ..
 > > ..
 > > try
 > > {
 > > String p=request.getParameter("ID");
 > > if(p != null)
 > > {
 > >   String to=p+"@asiamail.com";
 > > }
 > > else
 > > {
 > >   String to="[EMAIL PROTECTED]";
 > > }
 > >
 > > }
 > > ..
 > > ..
 > > **********************************************
 > > --
 > >
 > > _______________________________________________
 > > Get your free email from
 > http://freemail.asiamail.com
 > >
 > >
 >

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to