I am trying to run a project in Spring MVC. Here is the code
index.jsp
<%@page contentType=\"text/html\" pageEncoding=\"UTF-8\"%>
<%@taglib
You must bind the Date
when you submit a HTTP POST. Spring does not know that this is a Date
, it sees it as a String
.
Add this:
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
sdf.setLenient(true);
binder.registerCustomEditor(Date.class, new CustomDateEditor(sdf, true));
}
To your controller.
According to your code you are using
<prop key="index.htm">indexController</prop>
<a href="register.htm">click</a>
in above code spelling is not correct (htm instead of HTML).
<prop key="index.html">indexController</prop>
<a href="register.html">click</a>