I suspect this is an issue with how the security Filter is configured. If
you post your web.xml it may give us more insight.
On Tue, Jul 3, 2012 at 12:59 AM, sirj <wang
...@gmail.com> wrote:
> I have a webapp using sitemesh3, here is the sitemesh3.xml:
> <sitemesh>
> <mapping>
> <path>/mystuff/*</path>
> <decorator>/WEB-INF/decorators/en-layouts/mystuff.jsp</decorator>
> <decorator>/WEB-INF/decorators/en-layouts/header.jsp</decorator>
> </mapping>
> <mapping>
> <path>/*</path>
> <decorator>/WEB-INF/decorators/en-layouts/page.jsp</decorator>
> <decorator>/WEB-INF/decorators/en-layouts/header.jsp</decorator>
> </mapping>
> <mapping path="/js/*" exclude="true"/>
> <mapping path="/css/*" exclude="true"/>
> <mapping path="/images/*" exclude="true"/>
> <mapping path="/bootstrap/*" exclude="true"/>
> </sitemesh>
> I'm using spring security with this webapp. in the header.jsp, there is
> some code:
> <%
> Authentication a = SecurityContextHolder.getContext().getAuthentication();
> UserAccount u = null;
> if(a != null && a.getPrincipal() != null && a.getPrincipal() instanceof
> UserAccount){
> u = (UserAccount)a.getPrincipal();
> request.setAttribute("account", u);
> }
> %>
> and some html:
> <p class="navbar-text pull-right">Logged in as <a
> href="#">${account.nickname }</a></p>
> for above JSP code, all pages except http://www.mysite.com/ work very
> well. when accessing the context root url (/) of the app, variable a is
> null, i can't get it. when accessing any other pages like
> http://www.mysite.com/offer/39 or http://www.mysite/mystuff/, all pages
> are good.
> I don't know if my question is clear for you, could you anybody please
> give me some tips help me out?
> thank you in advance.
> Regards,
> Jason