我认为问题是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,你最初发送的表单输入参数不再存在。你应该重新考虑如何执行此操作。



