my dog learned polymorphism*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes RequestDispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "RequestDispatcher" Watch "RequestDispatcher" New topic
Author

RequestDispatcher

Sharma Anjali
Ranch Hand

Joined: Feb 22, 2005
Posts: 63
JQPLus
Ques ID: 1074483088810

Which of the following statements is correct regarding a RequestDispatcher?

Ans
The execution control returns to the resource that has called the forward() method after the callee resource finishes processing.

Explanation
RequestDispatcher.forward() is also a normal method call, so the control does return to the calling resource

Is this correct? Doesn't forward means go to the next resource ?
Rohit Bhagwat
Ranch Hand

Joined: Dec 19, 2004
Posts: 205
Hi Anjali

Nice question

Forward is a normal method so the control does comes back to the caller.

However the control also goes to the forwarded resource for processing..

But if you write to response something after forward then it will be ignored because the response gets commited after the control returns. So it will give IllegalStateException.

Regards
Rohit
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: RequestDispatcher
 
Similar Threads
Which of the following statements is correct regarding a RequestDispatcher object?
[HFSJ 2nd Edition] chapter 5 Mock Exam Question # 15
Request Dispatcher
regarding a RequestDispatcher object
forward--RequestDispatcher