org.springframework.web.util.NestedServletException: Request processing fail

出现这个错误 一直以为是表单数据没传进controller

最后是发现日期转换问题 期间还一直报400

<td><input type="text" name="createtime" value="<fmt:formatDate value="${item.createtime}" pattern="yyyy-MM-dd HH:mm:ss"/>"/></td>
@InitBinder
public void initBinder(WebDataBinder binder) throws Exception {
   // Date.class必须是与controler方法形参pojo属性一致的date类型,这里是java.util.Date
   binder.registerCustomEditor(Date.class, new CustomDateEditor(
         new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), true));
}

猜你喜欢

转载自blog.csdn.net/weixin_33145939/article/details/80582606
今日推荐