Rob Spoor wrote:
Danny Baquilod wrote:java.lang.NullPointerException
at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1235)
at java.text.DateFormat.parse(DateFormat.java:335)
at AddUser.doPost(AddUser.java:80)
The only parsing I see is that of dateCreate which is initialized here:
This error indicates that dateCreate is null, which means that the parameter is not present.
Paul Clapham wrote:That probably means that something was null in a place which can't handle nulls. Unfortunately you don't know where that place is, because when you printed the exception you didn't print that information. So take line 60 and print the stack trace:
(There's no point in printing the word "Error", when you see the stack trace you'll know that an error occurred anyway.)
The stack trace will tell you what line of your code threw the exception, so start there.
Rob Spoor wrote:Well, you got the parsing correct. Now all you need to do is turn a java.util.Date object into a java.sql.Date object:
Likewise for java.sql.Time and java.sql.Timestamp.
Rob Spoor wrote:
Danny Baquilod wrote:
Rob Spoor wrote:Use DateFormat / SimpleDateFormat and their parse methods.
Thanks. Would you mind putting the script here?
Please SearchFirst. There are millions of examples on the Internet, including hundreds (if not thousands) on the Ranch itself.
Rob Spoor wrote:Use DateFormat / SimpleDateFormat and their parse methods.
Bear Bibeault wrote:Java code and a result set in a JSP?
In an case, you should be looking at the HTML thtas generated rather than thesaource code.
But, your href is missing the contex path,and why does it have the host part of the URL? Is it in a separate web app?
Bear Bibeault wrote:Submitting to a JSP is a very poor practice.
You might find this article helpful.
Jeanne Boyarsky wrote:Danny,
Welcome to CodeRanch!
What yo posted is the correct way of sending a parameter. Note that it is good practice to keep code (especially JDBC code) out of the JSP. Instead store it in the request attribute and read that in the JSP. Search MVC for more detail.