I am using Spring MVC and Spring Security version 3.0.6.RELEASE. What is the easiest way to get the user name in my JSP? Or even just whether or not the user is logged in? I
I agree with alephx, I even voted his answer.
But if you need another approach, you could use the one that Spring Roo uses.
If you have the SecurityContextHolderAwareRequestFilter, it provides the standard servlet API security methods, using a request wrapper which accesses the SecurityContext.
This filter is registered with the
tag from the Spring Security namespace. You can also register it in the FilterChainProxy's security filter chain (just add the reference to a declared bean in your applicationContext-security.xml)
Then, you can access the security servlet API as Roo does (find the footer.jspx to see how a conditional logout link is written)
...