sitemesh + spring security: show logged in user in main decorator page!
I want to show logged in user in main decorator page. i use :
<decorator:usePage id="myPage"/>
Logged in as:<%= myPage.ge开发者_如何学CtRequest().getUserPrincipal().getName()%>
<decorator:body/>
but not work!
You need to place the SiteMesh filter-mapping below the Spring Security filter mapping.
See: Spring security tags in sitemesh decorator
Haven't worked with SiteMesh for quite some time, but why aren't you using the implicit request
object instead (I assume your pages are written in JSP, right?)
<%= request.getUserPrincipal().getName() %>
And what's exactly not working? Is an exception getting thrown?
精彩评论