Hi,

Thank you for your answer. Fortunatly I found the solution to my problem
here:

http://www.mail-archive.com/user@struts.apache.org/msg71987.html

I had to use the Struts 2 session instead of the HttpServletRequest session
:

// old
HttpSession session = request.getSession();

// now
Map sessionMap = ActionContext.getContext().getSession();

Hoping this will help others as well,

Regards
PBR


On 20 May 2010 18:12, Kartik Kumar <krishnan.1...@gmail.com> wrote:

> I have found that when your interceptor implements SessionAware and puts
> some key/value pairs in the map, the session attributes are not available
> to
> the action even  if it implements SessionAware. To get the session
> attribute, I did something like this:
>
> @SuppressWarnings("unchecked")
> Map<Object, Object> sessionMap =
> invocation.getInvocationContext().getSession();
>
> On Thu, May 20, 2010 at 5:22 AM, Pierre BRARD <brard.pie...@gmail.com
> >wrote:
>
> > Hi all,
> >
> > I am implementing a login system with Struts 2.
> >
> > Basically, I have a custom interceptor which checks in session if a
> > particular variable is set. If it is, the user is considered already
> logged
> > in and if it is not the variable is set in session (
> > session.setAttribute("connectedUser", user); ).
> >
> > Now, the problem is that this variable is null in my Action (through
> > SessionAware or not) or in my page (#session.myvar) during the first
> > request
> > (when the variable is first set in session).
> > It is only gets set with the second request.
> >
> > Am I missing an essential concept in the "page process and session
> > lifecycle" or is this a plain algorithm mistake ?
> >
> > Thanks in advance for any help,
> > PBR
> >
>

Reply via email to