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