struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Belingueres <belingue...@gmail.com>
Subject Re: [Struts2] session variable empty in the JSP
Date Mon, 27 Feb 2012 15:00:52 GMT
Post the code in which you actually set the attribute in the session scope.

2012/2/27 Samuel Robert <samuelrobert.job@gmail.com>:
> Hi,
>
> I faced few days ago a problem with the session variable in the JSP. I
> posted the problem here but did not get any solution:
> http://stackoverflow.com/questions/9381991/session-variable-empty-in-the-jsp-on-first-access-in-a-struts2-spring-applicatio
>
> Perhaps some of you have an idea.
>
> Basically the session variable in the JSP is empty on the first call to my
> action (when the session gets initialized).
> That means that my JSP fails to retrieve any information from the session
> in the Struts tags on the first display.
> From the second call it is OK.
>
> I have checked that the session is correctly initialized in the JSP. The
> problem comes only with the session variable in the struts tags.
>
> <% System.out.println(((my.bean.SessionBean)session.getAttribute("context")).getProfiles());
> %> => OK
>
> <s:property value="%{#session}"/> => KO (empty)
>
> ${session} => KO
>
>
> I solved it by adding an additional redirectAction on the first access
> (when I detect that it is a new session).
> But I wonder why I get such a problem, which I never had before.
>
> Thanks,
> Samuel

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message