Submission date as parameter from JSP to servlet

How to send date type as parameter from JSP to servlet to insert into MySQL database. When I use getParameter () in the servlet, it shows that I am using incompatible types. In fact, I declared a variable of type java.sql.Date, which I assign to the request parameter in the servlet, but I get an error that the types are incompatible. I am trying to send a date from JSP through a servlet to MySQL. How is the parameter transmitted and received in this case?

+3
source share
1 answer

Pass it as Stringand analyze it on the server using SimpleDateFormatto get Dateback

For instance:

Date date = new SimpleDateFormat("dd-MM-yyyy").parse("10-10-2010");
+8
source

All Articles