January 17th, 2002, 02:07 PM
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?
January 17th, 2002, 07:20 PM
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?
January 29th, 2002, 08:13 AM
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.