This will not work :-)
If Name by any chance is null
then Name.equals will throw nullpointer exception.
Correct way:
String Name = request.getParameter("Name");
if (Name != null) {
//do something
}
else {
//do something else - like "Please enter name or die"
}
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> Sanika Kapoor
> Sent: Wednesday, August 16, 2000 4:47 PM
> To: [EMAIL PROTECTED]
> Subject: Re: getParameter method return null string
>
>
> You can also check like this :
>
> String Name = request.getParameter("Name");
> if(!Name.equals(""))
> {
> do something
> }
> else
> {
> System.out.print(Name is returning null);
> }
>
> Sanika.
>
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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
___________________________________________________________________________
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