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 Web Component Certification (SCWCD/OCPJWCD) and the fly likes what does requestdispatcher forward call 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 » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "what does requestdispatcher forward call" Watch "what does requestdispatcher forward call" New topic
Author

what does requestdispatcher forward call

manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi
When using a dispatcher and calling .forward(), will doGet() or doPost() be called in the target servlet?

Rgrds
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3255
    
    2
Good question The answer depends on what kind of request your are forwarding - GET or POST. If you are forwarding a GET request then doGet will be called, if you are forwarding a POST request then doPOST will be called. Remember that it has nothing to do with the method (doGet or doPost) of the calling servlet. As you are probably aware, many people call doPost from doGet and do all the stuff in doPost (to avoid coding the same thing in both the methods). So if you are forwarding a GET request (from doPost), the other servlet will still get a GET request (not a POST).
HTH,
Paul.


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi Anil
Good Answer.
Rgrds
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
also the request to the target servelet will be delegated to the appropriate doGet/doPost via its own service method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what does requestdispatcher forward call
 
Similar Threads
WA #1.....word association
Free chapters of The Joy of Clojure are coming properly
Exam Results
Inter Servlet Communication
enable/disable Buttons