File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "RequestDispatcher" Watch "RequestDispatcher" New topic


Sharma Anjali
Ranch Hand

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

Which of the following statements is correct regarding a RequestDispatcher?

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

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.

I agree. Here's the link:
subject: RequestDispatcher
It's not a secret anymore!