I have a web application with Spring 3.0 and using Spring -MVC. I have several controllers configured like this:
@Controller @RequestMapping("/admin") @SessionAttributes({"clientLogin", "selectTab", "user", "redirectUrl"}) public class AdminController { ... } @Controller @SessionAttributes({"clientLogin", "selectTab", "user", "redirectUrl"}) public class PublicController { .... }
I can add annotated variables to ModelMap with something like
map.addAttribute("user", "Bob");
This works great to save a variable in the current controller; I can access var from modelMap from any other method in this controller. But when the user clicks the page on another controller, although the same variable is specified in the @SessionAttributes attributes, it is not available in the second controller.
Is it possible to access these annotated variables through multiple controllers using annotations?
source share