b.equals("yes") == true
this is where problem lies since you are
using method equal on an object b which is null.
Regards
Alok




Brad Whiting <[EMAIL PROTECTED]> on 09/25/2001 10:09:49 AM

Please respond to "A mailing list for discussion about Sun Microsystem's Java
      Servlet API Technology." <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Alok Dubey/JAMNAGAR/RIL)
Subject:  Null pointer exception



Hello all,

I am a rookie java servlet programmer, and I am getting an error that is
confusing me.

I have created an HTML form that has a large number of check boxes.  The idea
being that each checkbox represents a column in a database.  I hope to structure
an sql call that will include only the checked columns.  The odd thing about the
program is that it works fine if I check every box.  If I leave any unchecked I
get a null pointer exception at the point in the code where I am checking to see
if the box is checked.

This is an example of my html input statement:

<input type=checkbox name=cpumod value="yes"> CPU Model

This is an example of my servlet code that checks:

String b       = req.getParameter("cpumod");
 if (b.equals("yes") == true)
    sqlcom2 += ",\n CPUMOD";

This is the exception I see in my logs:

Instantiate: DBgetsysid
Sep 24, 2001 17:57:08.357 PM  12d7140000000019:Thread-13:130899e0 StrictServlet
X doService
                                 java.lang.NullPointerException
.at DBgetsysid.doPost(DBgetsysid.java:68)

BTW I am using doPost to process the form.  Can anyone help me with my mistake?
I just can't see it.


TIA,
brad

Hello all,
 
I am a rookie java servlet programmer, and I am getting an error that is confusing me.
 
I have created an HTML form that has a large number of check boxes.  The idea being that each checkbox represents a column in a database.  I hope to structure an sql call that will include only the checked columns.  The odd thing about the program is that it works fine if I check every box.  If I leave any unchecked I get a null pointer exception at the point in the code where I am checking to see if the box is checked.
 
This is an example of my html input statement:
 
<input type=checkbox name=cpumod value="yes"> CPU Model
 
This is an example of my servlet code that checks:
 
String b       = req.getParameter("cpumod");    
 if (b.equals("yes") == true)                    
    sqlcom2 += ",\n CPUMOD";    
 
This is the exception I see in my logs:
 
Instantiate: DBgetsysid                                                                      
Sep 24, 2001 17:57:08.357 PM  12d7140000000019:Thread-13:130899e0 StrictServlet X doService   
                                 java.lang.NullPointerException                               
.at DBgetsysid.doPost(DBgetsysid.java:68)                                                
 
BTW I am using doPost to process the form.  Can anyone help me with my mistake?  I just can't see it.
 
 
TIA,
brad
 

Reply via email to