Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher

 
Sharma Anjali
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic