Values of @PathVariable and @ModelAttribute overlapping

后端 未结 2 1687
北海茫月
北海茫月 2021-01-11 18:03

I have an User object stored in the session with @SessionAttributes. And a straight-forward method decorated with @ModelAttribute in o

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-11 18:48

    use @SessionAttribute

    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
        public String showItem(@PathVariable("id") Long id, @SessionAttribute("user") User user,
                Model uiModel) {
       ...    
    }
    

提交回复
热议问题