路径转发进行值传递
@RequestMapping("/forward")
public String goTo(HttpServletRequest httpServletRequest){
httpServletRequest.setAttribute("msg","成功");
httpServletRequest.setAttribute("code",200);
return "forward:/success";
}
@RequestMapping("/success")
@ResponseBody
public Map success(HttpServletRequest httpServletRequest){
Object msg=httpServletRequest.getAttribute("msg");
Object code=httpServletRequest.getAttribute("code");
Map<String, Object> map = new HashMap<>();
map.put("msg",msg);
map.put("code",code);
return map;
}