Hi:

Thanks guys for your replies. Duane was right. It works by
using forward to transfer information from servlet to that.jsp:

   RequestDispatcher dispatcher =
   getServletContext().getRequestDispatcher(/path/to/that.jsp);
   dispatcher.forward(request, response);

Have a nice weekend!

Peter

>From: Kate Hocking <[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: Fri, 10 Nov 2000 12:14:26 +0800
>
>putValue/setValue are API spec 2.1
>setAttribute/getAttribute are API spec 2.1
>
>...check to see what version of API you are referencing.
>
>Rgds,
>Kate
>
>-----Original Message-----
>From: Mohankarthikeyan.K,AMB Chennai.
>[mailto:[EMAIL PROTECTED]]
>Sent: Friday, 10 November 2000 12:15
>To: [EMAIL PROTECTED]
>Subject: Re: Communicate session between servlet and JSP
>
>
>Hi
>
>Try this.
>
>Use putValue("name",value) and getValue("name") methods instead of
>setAttribute and getAttribute.
>
>Mohan.
>
> > -----Original Message-----
> > From: Peter Smith [SMTP:[EMAIL PROTECTED]]
> > Sent: Thursday, November 09, 2000 3:54 PM
> > 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
>____________________________________________________________________________
>________________________________________
>
>IMPORTANT:  This email is intended only for the use of the individual or
>entity named above and may contain information that is confidential and
>privileged. The views expressed in this e-mail are those of the author and
>not of the company unless otherwise clearly indicated.  When addressed to
>our clients, any information or quotes contained in this e-mail are subject
>to the terms and conditions relevant at that time to the matter being
>addressed.  If you are not the intended recipient and have received this
>e-mail in error, please notify us immediately by return email or telephone
>+61 8 93235555 and delete the e-mail and any attachments without using or
>disclosing the contents in any way.  If you are not the intended recipient
>any dissemination, distribution or copying of this e-mail is strictly
>prohibited. Before opening or using attachments, check them for viruses and
>defects.  Our liability is limited to re-supplying any affected
>attachments.
>
>___________________________________________________________________________
>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

Reply via email to