I have the following problem.
In my Spring MVC web application there is some class of command object with Calendar property.
public class TestBean {
private Calendar startDate;
//other properties
//setters and getters
}
In my JSP page I have form like below:
<form:form method="post" commandName="testBean">
<form:input path="startDate" cssClass="forminput" />
</form:form>
but i would like to add only year (“yyyy”) in above form input and map it to above montioned Calendar property (It can be dafault date but with year specified on input, for example: 01-01-2012). Is it possible?
I would be grateful for any help.
I recommend you to implement your own Spring converter here:
And register it in your Spring XML configuration: