Spring MVC "The request sent by the client was syntactically incorrect ()"解決辦法:
把spring日志級別調整到debug級別,可以看到更多的前端請求后台的日志,可以更精確的定位到底哪里出錯了。
log4j.properties添加一行:
log4j.logger.org.springframework=DEBUG
看到console控制台日志:日期轉換異常。一般是你前端的頁面的日期傳到后台,格式轉換異常。需要你重新設置下日期格式,前后端要對應。
解決方法:Controller層加入轉換方法
/* * 解決createTime格式轉換問題Date to String */ @InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); }
參考文獻:http://blog.csdn.net/yiluoak_47/article/details/10821747