Aew galera tenho uma data que vem de um formulario no formato mm/dd/yyyy no caso como uma String, quero colocar essa data na base do mysql, olha como estou fazendo:
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
Date dateFrom=new Date(from);
Date dateTo=new Date(to);
stmt.setDate(4,formatter.format(from));
stmt.setDate(5,formatter.format(to));
olha o erro:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 5 in the jsp file: /inclusao.jsp
Generated servlet error:
The method setDate(int, Date) in the type PreparedStatement is not applicable for the arguments (int, String)
An error occurred at line: 5 in the jsp file: /inclusao.jsp
Generated servlet error:
The method setDate(int, Date) in the type PreparedStatement is not applicable for the arguments (int, String)
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 5 in the jsp file: /inclusao.jsp
Generated servlet error:
The method setDate(int, Date) in the type PreparedStatement is not applicable for the arguments (int, String)
An error occurred at line: 5 in the jsp file: /inclusao.jsp
Generated servlet error:
The method setDate(int, Date) in the type PreparedStatement is not applicable for the arguments (int, String)
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
…