@RequestMapping(value = "/index", method = RequestMethod.GET)
public String printPublicHome(ModelMap model) {
- model.addAttribute("message", "Spring Security Custom Form example");
+ model.addAttribute("username", getPrincipalName());
+ if (isUserRole())
+ return "home";
return "public";
}
}
@RequestMapping(value = "/home", method = RequestMethod.GET)
- public String printHome(ModelMap model ) {
+ public String printHome(ModelMap model) {
model.addAttribute("username", getPrincipalName());
return "home";
}