struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Pratt" <thechrispr...@gmail.com>
Subject Re: Losing session object?
Date Thu, 21 Sep 2006 20:16:04 GMT
By doing a forward (as opposed to a redirect) you actually have access to
more data, not less.  You have access to the request, session and
application scopes with a forward, whereas you only have session and
application scope access with a redirect.  Notice though that you should
always have access to the session from within the same web application
context.  So the two possibilities that come to mind are that you are moving
from one web application context to another (i.e. from one war file to
another) or that you have  <%@ page session="false"%> at the top of your
pages, explicitly blocking session access.
  (*Chris*)

On 9/21/06, Darren Hall <dhall@utrs.com> wrote:
>
> I'm thinking my problem might be related to the fact that my mappings in
> struts-config.xml are using forwards? Does this sound like it could be the
> problem? For example, from the home page you can link to the FAQ page.
> Here
> is the mapping for the FAQ page from my struts-congif.xml file: "<action
> path="/home/faqs/" forward="flc.faqs" />". By doing a forward action, does
> my session get losdt somehow?
>
> -D
>
> >
> > Quick question -
> >
> > I have a web application built on Struts 1.2.9. The home page places a
> > "user" object in the current session when it executes using the
> following
> > code:
> > ...
> > //Call common methods
> > userSession = getUserSession(request);
> > request.getSession().setAttribute("userSession", userSession);
> > ...
> > One of the tiles in my jsp layout reads out values from my userSession
> > bean using the following code:
> > ...
> > <bean:write name="userSession" property="domain(Primary)"/>
> > ...
> > This works fine, and the home page displays correctly. Some links from
> the
> > home page use action forwards directly to jsp pages with no Action
> classes
> > associated with them. In these cases, I again try to read values from
> the
> > userSesison bean (as above) and I get a "javax.servlet.jsp.JspException:
> > Cannot find bean: "userSession" in any scope" error when these jsp pages
> > are loading. Why is this happening? If I've already put the "user"
> object
> > in the session when the user first hits the home page, shouldn't that
> > object persist to other jsp pages??
> >
> > Thanks,
> > Darren
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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