I have a web app running Spring 3.0 and using Spring-MVC. I have a few controllers set up 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 the annotated variables into the ModelMap with something like
map.addAttribute("user", "Bob");
That works fine to persist the variable in the current controller; I can access the var from the modelMap from any other method in that controller. But when the user hits a page in another Controller, even though the same variable is listed in the @SessionAttributes, it's not available in the second controller.
Is it possible to access these annotated variables across multiple controllers using the annotations?