This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes RequestDispatcher.forward or Response.sendRedirect? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "RequestDispatcher.forward or Response.sendRedirect?" Watch "RequestDispatcher.forward or Response.sendRedirect?" New topic
Author

RequestDispatcher.forward or Response.sendRedirect?

Rohit Malhotra
Greenhorn

Joined: Jan 29, 2006
Posts: 21
Hi,

I am kinda write a file upload Application where the User gives the input file and the Servlet uploads it and now i want to transer the control back to the JSP allowing more files to be uploaded.
What should i use. RequestDispatcher.forward("UserTasks.jsp") or response.sendRedirect("UserTasks.jsp");
Also when i try using response.sendRedirect i keep on getting this error:=

java.net.SocketException: Software caused connection abort: socket write error

My jsp page is in the Application root directory and the servlet classes are in root\web-inf\classes directory..
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
If the JSP page is within the same application use RequestDispatcher.forward


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RequestDispatcher.forward or Response.sendRedirect?