struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samuel Robert <samuelrobert....@gmail.com>
Subject [Struts2] session variable empty in the JSP
Date Mon, 27 Feb 2012 13:33:03 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message