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
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
posted
0
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
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
posted
0
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.