tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msasc...@esg-gmbh.de
Subject Re: sessions and JSP Tag Handlers
Date Mon, 10 Jul 2000 07:48:10 GMT
Joel,

a similar approach is working with my web app. The difference is that I request
and set the session within a servlet

<code>
    HttpSession session = p_requ.getSession( true );
    session.setAttribute( "user", objUser );
</code>

The attribute is accessed in a tag much the same as in yours.

I agree that you problem is related to the session ID or its creation.
Do your JSP's reside in the same directory? The browser might choose to
invalidate the cookie that's describing your session ID. That's even more the
case if you are working with applets.
Also it may be necessary to explicitely create a session as in my servlet.

Please let me know, if you've solved the problem.





Joel Regen <joel@Globeset.com> am 08.07.2000 19:09:49

Bitte antworten an tomcat-user@jakarta.apache.org; Bitte antworten an
      joel@Globeset.com

An:   tomcat-user@jakarta.apache.org
cc:    (Blindkopie: Martin Saschek/ESG/DE)

Thema:    Re: sessions and JSP Tag Handlers





Joel Regen wrote:

> Hello,
>
> I am working on a product demo for a web-based payment collection service.  In
> the demo, I am using the session to hold various objects.  For example, a
> merchant id (ID) is stored in the session at the first request (in a jsp
page).
> This is done within a Tag Handler by accessing
>
>              pageContext.getSession().setAttribute("merchantID", ID);.
>
> I have discovered that this is not working as expected:  an attempt to access
> ID:
>
>             pageContext.getSession().getAttribute("merchantID");
>
> from a different jsp page and a different tag handler yields a null value. I
> assumed that the session object was maintained across pages by the JSP
container
> (tomcat) and that accessing it via the page context would work since, by
> default, jsp pages participate in sessions.
>
> What am I missing here?
>
> I've looked at the source code: Tomcat is obtaining the session object from
the
> request, as expected, in PageContextImpl:
>    ...
>     if (request instanceof HttpServletRequest && needsSession)
>         this.session = ((HttpServletRequest)request).getSession();
>    ...
>
> But the session is changing between pages as evidenced by log("session id is:
"
> + session.getId()); calls on different pages.   This makes me suspect some
sort
> of problem with the request mechanism....I don't know...
>
> I don't get it.
>
> thanks,
> Joel

additional information:
____________________________________________________________________
in server.xml:
        <RequestInterceptor
className="org.apache.tomcat.request.SessionInterceptor"
debug="9"/>
____________________________________________________________________
in tomcat.log (from one request to select_instrument.jsp):
.....
 Orig sessionId  To1012mC8881234732891015At
 XXX RURI=/PCSDemo/select_instrument.jsp
createRequest /select_instrument.jsp /PCSDemo/select_instrument.jsp
 XXX RURI=/PCSDemo/select_instrument.jsp
Context log: path="/PCSDemo" Get real path /select_instrument.jsp
D:\dev\PCSDemo\jakarta-tomcat\webapps\PCSDemo\select_instrument.jsp
/select_instrument.jsp
createRequest /select_instrument.jsp /PCSDemo/select_instrument.jsp
 XXX RURI=/PCSDemo/select_instrument.jsp
Context log: path="/PCSDemo" Get real path \select_instrument.jsp
D:\dev\PCSDemo\jakarta-tomcat\webapps\PCSDemo\select_instrument.jsp
/select_instrument.jsp
createRequest /select_instrument.jsp /PCSDemo/select_instrument.jsp
 XXX RURI=/PCSDemo/select_instrument.jsp
Context log: path="/PCSDemo" Get real path \select_instrument.jsp
D:\dev\PCSDemo\jakarta-tomcat\webapps\PCSDemo\select_instrument.jsp
/select_instrument.jsp
createRequest /select_instrument.jsp /PCSDemo/select_instrument.jsp
 XXX RURI=/PCSDemo/select_instrument.jsp
Context log: path="/PCSDemo" Get real path \select_instrument.jsp
D:\dev\PCSDemo\jakarta-tomcat\webapps\PCSDemo\select_instrument.jsp
/select_instrument.jsp
createRequest /select_instrument.jsp /PCSDemo/select_instrument.jsp
 XXX RURI=/PCSDemo/select_instrument.jsp
Context log: path="/PCSDemo" Get real path \select_instrument.jsp
D:\dev\PCSDemo\jakarta-tomcat\webapps\PCSDemo\select_instrument.jsp
/select_instrument.jsp
Before Body To1010mC8882894419450669At
.....








Mime
View raw message