The request sent by the client was syntactically incorrect
The request sent by the client was syntactically incorrect.
spring mvc报错:The request sent by the client was syntactically incorrect. 是Date格式转换的错误
解决方案:建议先自动转成String类型,再手动转成Date类型
public String list(ModelMap model,Long userId,String beginDate,String endDate){ try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map<String, Object> map = Maps.newHashMap(); map.put("userId", userId); if (StringUtils.isNotEmpty(StringUtils.trim(beginDate))) { Date date = sdf.parse(beginDate); map.put("beginDate", date.getTime()); } if (StringUtils.isNotEmpty(StringUtils.trim(endDate))) { Date date = sdf.parse(endDate); map.put("endDate", date.getTime()); }