Hi Stephen,
I noted there is not a space between the pQ2="", so maybe put pQ2=" " or
pQ2=' ' where a single quotation mark denotes a char space. The difference
between == and .equals() should not matter since you are working with a
String A.K.A. an Object.
Tom Kochanowicz
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Lambert, Stephen : CO IR
Sent: Monday, April 17, 2000 5:40 PM
To: [EMAIL PROTECTED]
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