RequestDipstacher reqDisp =
request.getRequestDispatcher("AnotherJSP.jsp");
    /*
     or
            RequestDipstacher reqDisp =
config.getServletContext().getRequestDispatcher("/MyWebApp/AnotherJSP.jsp");
    */
    reqDisp.forward(request, response);


Pramod


----- Original Message -----
From: "Monte Gardner" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 02, 2002 8:12 PM
Subject: Re: redirect and sessions


> I looked up RequestDispatcher in my JSP book, but the examples it gives
are
> confusing.  Can someone show me how to use requestDispatcher to cause the
> web browser to automatically continue on to another JSP page, while
ensuring
> that objects written to the sesssion in the first page will be available
in
> the second?
>
> --thanks
> --Monte Glenn Gardner
>
>
> On Mon, 12 Aug 2002, Bhangale, Bhushan wrote:
>
> > You should use RequestDispatcher if redirecting the request in same
server
> > and where you want to retrieve the request and session objects set in
> > previous requests.
> >
> > Do remember to use encodeURL always.
> >
> > -----Original Message-----
> > From: Gardner Monte [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, August 10, 2002 5:47 PM
> > To: [EMAIL PROTECTED]
> > Subject: redirect and sessions
> >
> >
> > I just found something weird.
> >
> > I'm creating a JSP app, using IE 5.5 to view it.
> > In one page, I was writing an object to the session variable like so
> >   request.getSession(true).setAttribute("user",user);
> >   response.sendRedirect("portfolio.jsp");
> >
> > then, in portfolio.jsp, the next page, I was trying to read that same
object
> > like so
> >
> >    Arist user = (Artist)session.getAttribute("user");
> >
> >
> > but the user variable kept on beeing null, as if it had
> > never been written to the session.  However, when I changed
> > the first part of the code by taking out the redirect, and
> > just putting in a link to portfolio.jsp, it worked fine, the User object
was
> > read from the session variable just like I wanted it to.
> >
> > So my question is, is there some kind of effect that
> > sending a redirect has on session management?
> >
> >
> >
> > --Monte Glenn Gardner
> >
> >
___________________________________________________________________________
> > 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
> >
> >
> > "The information in this e-mail, and any attachment therein, is
> > confidential and for use by the addressee only. If you are not the
> > intended recipient, please return the e-mail to the sender and delete
> > it from your computer. Although The Bank of New York attempts to
> > sweep e-mail and attachments for viruses, it does not guarantee that
> > either are virus-free and accepts no liability for any damage sustained
> > as a result of viruses."
> >
> >
___________________________________________________________________________
> > 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
>

___________________________________________________________________________
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