This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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
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