I am trying to use a datepicker calender with Spring MVC submission form.I am able to use the date calender in the form,but when i submitting the page i want to see the values in the controller rest of the values are coming to the servlet but the date is not coming .i a posting the code below This is the form in the view page
<div align="center">
<form:form action="forms/registerResult" method="post"
commandName="userForm">
<table border="0">
<tr>
<td colspan="2" align="center"><h2>Spring MVC Form Demo -
Registration</h2></td>
</tr>
<tr>
<td>User Name:</td>
<td><form:input path="username" /></td>
</tr>
<tr>
<td>Password:</td>
<td><form:password path="password" /></td>
</tr>
<tr>
<td>E-mail:</td>
<td><form:input path="email" /></td>
</tr>
<tr>
<td>Birthday (mm/dd/yyyy):</td>
<td><form:input path="birthDate" /></td>
</tr>
<tr>
<td>Profession:</td>
<td><form:select path="profession" items="${professionList}" /></td>
</tr>
<tr>
<td>Date:</td>
<td><form:input path="date" id="datepicker" /></td>
<script>
$(function() {
$("#datepicker").datepicker();
});
</script>
</tr>
<tr>
<td>Skills:</td>
<td><form:select path="javaSkills" items="${javaSkillsList}"
multiple="true" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit"
value="Register" /></td>
</tr>
<tr>
<td>Sex :</td>
<td><form:radiobutton path="sex" value="M" />Male <form:radiobutton
path="sex" value="F" />Female</td>
</tr>
</table>
</form:form>
</div>
这是我的保护手册。
public class AppContoller {
@RequestMapping(value="/register",method=RequestMethod.GET)
public String viewRegistration(Map<String,Object>model){
User userForm=new User();
model.put("userForm", userForm);
List<String> professionList=new ArrayList<String>();
professionList.add("Developer");
professionList.add("Designer");
professionList.add("IT Manager");
model.put("professionList",professionList);
List<String> javaSkillsList=new ArrayList<String>();
javaSkillsList.add("JAVA");
javaSkillsList.add("C#");
javaSkillsList.add("C++");
model.put("javaSkillsList",javaSkillsList);
return "Registration";
}
@RequestMapping(value="/registerResult",method=RequestMethod.POST)
public String processRegistration(@ModelAttribute("userForm")User user,Map<String,Object> model){
System.out.println("username:"+user.getUsername());
System.out.println("password:"+user.getPassword());
System.out.println("email:"+user.getEmail());
System.out.println("birth date:"+user.getBirthDate());
System.out.println("profession:"+user.getProfession());
System.out.println("skills:"+user.getJavaSkills());
System.out.println("date:"+user.getDate());
return "RegistrationSuccess";
}
系统.out.println (“date:”+user.getDate ()); is not come to the console.please any person help.