Hi,
This is an excellent way to answer.
Suman
At 10:01 AM 08/16/2000 -0500, Milt Epstein wrote:
>On Wed, 16 Aug 2000, Srini Sathya. wrote:
>
>> purav, this is a sarcastic answer, u put an elemantry question and
>> got reply from one of the subscribers. Please refrain urself in
>> either posting this kind of elemantary question in future or be
>> prepared to digest the sarcastic answers.
>
>The sarcasm might have been more effective if the code had been
>correct.
>
>This question (and/or similar ones) has come up a number of times on
>this list, and frankly I'm amazed each time how many incorrect answers
>are given -- I'm not sure there was one correct one! It's really not
>that complex, if you think about it and break it down a little (and do
>some testing!).
>
>You need to watch out for the parameter value being null and for it
>being empty (i.e. the empty string; I hesitate to use the term "null
>string", because it potentially confuses things). This can be done
>with:
>
>if (Name == null || Name.equals(""))
> ...
>else
> ...
>
>You could use 'Name.length() == 0' instead of 'Name.equals("")'.
>Note that the 'Name == null' check must come first, otherwise you risk
>a NullPointerException.
>
>
>> -----Original Message-----
>> From: Purav [mailto:[EMAIL PROTECTED]]
>> Sent: Wednesday, August 16, 2000 10:17 AM
>> To: [EMAIL PROTECTED]
>> Subject: Re: getParameter method return null string
>>
>>
>> Hi,
>>
>> So if I write
>> if(Name.equals("null"))
>> System.out.println("I have already invested in a Java book");
>> else
>> System.out.println("But Still I am Confused");
>>
>> will it work?
>>
>> Purav
>>
>>
>> ----- Original Message -----
>> From: "David Concannon" <[EMAIL PROTECTED]>
>> To: <[EMAIL PROTECTED]>
>> Sent: Wednesday, August 16, 2000 11:00 AM
>> Subject: Re: getParameter method return null string
>>
>>
>> > try
>> >
>> > if(Name.equals("null"))
>> > System.out.println("I need to invest in a Java book");
>> > else
>> > System.out.println("Or look at the API");
>> >
>> >
>> > -----Original Message-----
>> > From: Purav [mailto:[EMAIL PROTECTED]]
>> > Sent: Wednesday, August 16, 2000 9:55 AM
>> > To: [EMAIL PROTECTED]
>> > Subject: [SERVLET-INTEREST] getParameter method return null string
>> >
>> >
>> > Hi,
>> >
>> > The Request.getparameter() method return null string when it does not find
>> > the parameter. it does not return null as a keyword
>> >
>> > so if i write
>> > String Name=Request.getParameter("Name");
>> > if(Name==null)
>> > then something....
>> >
>> > It doesnt work
>> >
>> > I am little confused
>> >
>> > Can anybody help me out
>> >
>> > Purav
>> >
>>
>
>Milt Epstein
>Research Programmer
>Software/Systems Development Group
>Computing and Communications Services Office (CCSO)
>University of Illinois at Urbana-Champaign (UIUC)
>[EMAIL PROTECTED]
>
>___________________________________________________________________________
>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
********************
Suman Shekhar
PS ,IT-Engineer, (408) 8539546
*******************
___________________________________________________________________________
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