I have an HTML form in which I have text boxes, text areas, radio buttons , and checkboxes. I am getting form data and putting it into an Oracle database using preparedStatement. All of the fields may not be filled out so I am using this for string fields: <req:existsParameter name="supervisor"> <%supervisor = (request.getParameter("supervisor")); %> </req:existsParameter> which works. And for numeric fields (coming from the radio buttons and checkboxes) I am using this: <req:existsParameter name="training"> <%training = new Integer(request.getParameter("training")); %> </req:existsParameter> If any of the numeric fields are blank I get: Error: java.lang.NullPointerException
any help in this problem would be greatly appreciated.
B, Since Integer in java is immutable you must create it with a non-null value. There is no empty constructor. It also chokes on an empty String sent into the Integer constructor that accepts Strings. Therefore, you must see if the request parameter exists, is not null, and has some length before you just use it. Regards, Manfred.