compare with null like this ---> if (pQ2.equals(null))
// null should not be in quotes while comparison else it be taken as String
----- Original Message -----
From: Lambert, Stephen : CO IR <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 17, 2000 6:39 PM
Subject: checking for null in a doPost method
> I'm trying to pass blanks for a null into my db from an html form.
> Code as follows:
>
> String pQ2 = request.getParameter("check2");
> if (pQ2.equals("null") {pQ2="";
> }
>
> I end up with the error "java.lang.NullPointerException".
> Even though when I display the variable pQ2, it gives me "null"(no
quotes)
> using:
>
> out.println(pQ2);
>
> Anybody know how to check for null data from a doPost method?
> Thanks,
> Stephen.
>
>
___________________________________________________________________________
> 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