我认为问题在于Spring在提交以下
input字段时不知道如何反序列化浏览器客户端发送的日期
<tr name="tstest"> <td>Date Of Birth</td> <td><form:input path="dateOfBirth" name="timestamp" value=""/> <a href="javascript:show_calendar('document.tstest.timestamp', document.tstest.timestamp.value);"><img src="../images/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"></a> </td></tr>Spring不知道如何将您输入的值带入该字段并将其转换为
Date对象。您需要为此注册一个
PropertyEditor。例如,将以下内容添加到您的
@Controller课程中
@InitBinderpublic void initBinder(WebDataBinder binder) { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); sdf.setLenient(true); binder.registerCustomEditor(Date.class, new CustomDateEditor(sdf, true));}显然,将更
SimpleDateFormat改为客户端发送的内容。
在相关说明中,您通过发送重定向发送302响应
return "redirect:/full-reg";
请记住,请求和模型属性仅在一个请求期间有效。因此,当您的客户将请求发送到时
full-reg,您最初发送的表单输入参数不再存在。您应该重新考虑如何执行此操作。



