I have a bunch of controller methods in one class all need to add the same session attribute to the Model for front end UI to use. To avoid repetitively add " model.addAttribute("isAdmin", session.getAttribute("isAdmin"));" and add HttpSession session to every method header, what is the best way to do it? I am thinking of extending the Model, but I am not sure how to implement it. Thanks!
ex:
Code:@RequestMapping("/setUpForm.html") public String setupForm(Model model, HttpSession session) { model.addAttribute("isAdmin", session.getAttribute("isAdmin")); model.addAttribute(...); model.addAttribute(...); return .... }


Reply With Quote
