解决方案:
使用 Map传参 不使用 HttpServletRequest
之前
@RequestMapping("/hello2")
public String hello2(HttpServletRequest request) {
request.setAttribute("user", new User("zhangsan", 23));
return "hello2";
}之后
@RequestMapping("/hello2")
public String hello2(Map<String,Object> result) {
result.put("user", new User("zhangsan", 23));
return "hello2";
}结果

版权声明:本文为chengxi1014原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。