This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Need of two parameters in forward(request,response) & include(request,repsonse) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Need of two parameters in forward(request,response) & include(request,repsonse)" Watch "Need of two parameters in forward(request,response) & include(request,repsonse)" New topic
Author

Need of two parameters in forward(request,response) & include(request,repsonse)

samir vasani
Ranch Hand

Joined: Nov 24, 2010
Posts: 59
Hi Expert,

I would like to know what is the use of two parameters in forward(request,response).
It is understood that request is required as i am forwarding the data from one place to another place and that is also to do process something on the that side(jsp/servlet).
But once i forward the data it never comes back so i think no need for response object.(Correct this if i am wrong).
So please explain the reason of using response in forward method.
Ashwini Kashyap
Ranch Hand

Joined: Aug 30, 2012
Posts: 90
Hi Samir,

Yes you are incorrect. There is a need of response object.
It is possible that you may have a requirement wherein you send the response to the client using PrintWriter despite of forwarding request from one servlet to other resource.

For more details check this ServletResponse.

Thanks and Regards,
Ashwini Kashyap | akashyap@infocepts.com | www.infocepts.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need of two parameters in forward(request,response) & include(request,repsonse)
 
Similar Threads
HttpServletRequest parameter vs attributes ?
request
What is the diff between a RequestDispatcher object obtained from Request & Context
calling a jsp with href
Jsp code doubt