When you use sendRedirect, I think what is happening is that the browser is
getting
a simple response to the initial request, telling it to make another request
--
hence, the first time "that.jsp" sees the request, it's a new one.
If that.jsp is responsible for displaying the response to the first request,
forwarding
the request to the JSP is what you really want to do, and passing data
through the
request object is appropriate.
-----Original Message-----
From: Peter Smith [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 09, 2000 6:55 AM
To: [EMAIL PROTECTED]
Subject: Re: Communicate session between servlet and JSP
Hi, Duane:
No, I used sendRedirect:
response.sendRedirect(response.encodeURL("/path/to/that.jsp"));
to call that.jsp
George
>From: Duane Morse <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Communicate session between servlet and JSP
>Date: Thu, 9 Nov 2000 16:19:22 -0700
>
>Are you using the dispatcher to invoke the JSP, using the "forward" method
>and
>providing your current request object as the first argument?
>
>-----Original Message-----
>From: Peter Smith [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, November 09, 2000 5:33 AM
>To: [EMAIL PROTECTED]
>Subject: Re: Communicate session between servlet and JSP
>
>
>Hi, Duane:
>
>Thanks for your reply. I tried to use request object in my servlet:
>
>String teacher = new String("true");
>request.setAttribute("teacherTrace", teacher);
>
>And in jsp, use
>
>String teacher = (String)request.getAttribute("teacherTrace");
>
>However, I still got null for variable "teacher".
>
>Peter
>
>
> >From: Duane Morse <[EMAIL PROTECTED]>
> >Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> > Servlet API Technology." <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Re: Communicate session between servlet and JSP
> >Date: Thu, 9 Nov 2000 14:08:36 -0700
> >
> >Try passing the data on via the request object. That works regardless of
> >whether
> >a session has been established.
> >
> >-----Original Message-----
> >From: Peter Smith [mailto:[EMAIL PROTECTED]]
> >Sent: Thursday, November 09, 2000 3:24 AM
> >To: [EMAIL PROTECTED]
> >Subject: Communicate session between servlet and JSP
> >
> >
> >Hi:
> >
> >I created a session in a servlet, which involks a jsp as following:
> >
> >HttpSession session = request.getSession(true);
> >String teacher = new String("true");
> >session.setAttribute("teacherTrace",teacher);
> >response.sendRedirect(response.encodeURL("/path/to/that.jsp"));
> >
> >In that.jsp file, I tried to extract this session value:
> >
> >String sessionValue = (String)session.getAttribute("teacherTrace");
> >
> >However, sessionValue is null. I have set
> ><%@ session = true %>
> >
> >I'm running Tomcat3.1 on Unix.
> >Could anyone tell me how to communicate session between servlet and JSP?
> >
> >Thanks a lot in advance.
> >
> >Peter
> >_________________________________________________________________________
> >Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> >
> >Share information about yourself, create your own public profile at
> >http://profiles.msn.com.
> >
>
>___________________________________________________________________________
> >To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
> >of the message "signoff SERVLET-INTEREST".
> >
> >Archives: http://archives.java.sun.com/archives/servlet-interest.html
> >Resources: http://java.sun.com/products/servlet/external-resources.html
> >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
>
>___________________________________________________________________________
> >To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
> >of the message "signoff SERVLET-INTEREST".
> >
> >Archives: http://archives.java.sun.com/archives/servlet-interest.html
> >Resources: http://java.sun.com/products/servlet/external-resources.html
> >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>_________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>Share information about yourself, create your own public profile at
>http://profiles.msn.com.
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html