Last active
December 11, 2015 08:19
-
-
Save pikanji/4572772 to your computer and use it in GitHub Desktop.
Sample Spring MVC controller method that passes user name of the user logged in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping(value = "/", method = RequestMethod.GET) | |
public String home(Locale locale, Model model, Principal principal) { | |
//... | |
if (null != principal) { | |
model.addAttribute("userName", principal.getName()); | |
} | |
//... | |
return "home"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment