#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Posts
    0
    Rep Power
    0

    Forwards and requests.


    I have a page that receives some data posted from another page. If on that page I do jsp:forward to a third page, can I use request.getParameter(...) on the third page to retrieve the data originally posted to the previous page. In other words, does the request object preserve its data accross multiple jsp:forward's?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Posts
    45
    Rep Power
    14
    I haven't worked with jsp much, but I work with servlets everyday. I'm not sure if jsp:forward would work on the third page, but I know for sure that you could get the paremeters on the second page and put them in a session variable that would be available on the third page or any other page.

    Just a thought .....
    But maybe someone else that knows more about jsp would have a better solution?
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    1
    Rep Power
    0
    The simple answer is yes. A forward is an in memory transition unlike a redirect. The forward tag gets translated into something like this by the JSP engine:
    getServletContext().getRequestDispatcher( path ).forward( request, response );

    As you can see forward is a simple method call (in memory transition), the orignal request and response objects are passed as parameters to forward therefore the next page will have access to all the parameters.

IMN logo majestic logo threadwatch logo seochat tools logo