File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes forwarding problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "forwarding problem" Watch "forwarding problem" New topic
Author

forwarding problem

Sunil K Bansal
Ranch Hand

Joined: Jan 04, 2001
Posts: 62
Hi guys
I m forwarding from one JSP page(abc.jsp) to aother JSP page(xyz.jsp) for this I m using forward action
<jsp:forward page="xyz.jsp" />
i know when u forward the url in address do not change
but after going to xyz.jsp
when i submit this page it takes back to abc.jsp
I dont want to go back on abc.jsp i want to stay on xyz.jsp only
how to stop this?
Thanx and Regards
Bansal
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

There is a discussion on 'forward' in this thread
Short answer: forward works on the server side. The client (ie the browser) knows nothing about t and can't react to it.
DOM
Sunil K Bansal
Ranch Hand

Joined: Jan 04, 2001
Posts: 62
by using
response.sendRedirect("xyz.jsp");
parameters are not getting passed from abc.jsp to xyz.jsp
i need parameters from abc.jsp in xyz.jsp
Bansal
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

First I'd suggest playing with forward, since the JSPs share the request and response objects and you can use them to communicate.
If you absolutely need to use sendRedirect (because it is inefficient), you can either put the data on the session (not recommended) or add it to the URL (not recommended for sensitive data)
res.sendRedirect("xyz.jsp?name=Dave");
DOM
SAFROLE YUTANI
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
If you want to forward the entire request, which include the parameters, from one page to another page, then use the RequestDispatcher class.
On your JSP, execute the following code to send the client to the page of your choice, and let's use "/xyz.jsp" as an example for the page that we will forward the client.
request.getRequestDispatcher("/xyz.jsp).forward( request, response);
That's all you have to do. The request and response objects will be forwarded to the new URI, namely "/xyz.jsp"
SAF
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: forwarding problem