You say it is accepting the values. Does that mean if you add a print before this line, the four values aren't null?
Post by:Junilu Lacar
Welcome to the Ranch!
You really shouldn't be doing any kind of database access in a JSP. If you're following an example from a book, I'd suggest you get another book. That way of programming JSPs was way back in the very early days of Java.
I'm adding this thread to the JSP forum. Sheriff Bear will be around shortly to put you on the right path.
Post by:charless robinson
@Jeanne Boyarsky,Junilu Lacar.. Thank you for your reply.
The String values are given in HTMl page. I did not understand why the DB is showing null values. Its my school assignment.
Post by:Paul Clapham
I'm surprised that you are getting records written to the database at all, since that JDBC URL looks wrong to me. But if that code is actually adding rows to the database and the values in the rows are all null, then that inevitably means that your code put the nulls there. Jeanne suggested you should put some debugging code into your JSP to see if that's really the case -- I second that suggestion.
If you would like to test your HTML form independently of the JSP code, try specifying an action of http://httpbin.org/post in your form. httpbin is a test site and it will return back informaiton about your request (in JSON format). What would be interesting for your particular problem is what it returned in the JSON form attribute.
For example - I added another input element to your form.
If I enter Hello HTML in to my new element and submit the form to httpbin, I get this back:
In the form attribute there is one key/value pair: the key is what I specified as the name in my new input element; and the value is what I entered in the my new field in the form. As you have already know, to get this value in JSP, you would use request.getParameter("another-field-for-testing").
My suggestion: add the missing name attributes to your input elements, test with httpbin until the form is working as expected, then try with your JSP code again.