Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher forward doubt

 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The execution control returns to the resource that has called the forward() method after the callee resource finishes processing.

true or false

Please help!

thanks,
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, chandra.

Thats true.
I too don't know.. earlier but I saw here in some post discussing about that.


*** Note
There is difference betwwen the RequestDispatcher forward call and jsp:forward
jsp:forward never returns.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Srini,

There were contradiction between asked question and its description in
the mock exam question.

I got the clear idea after referring to some other sources and observing
it practically:

1- In case of include() control returns back to the caller
2- In case of forward() control is just delegated to the called source.
Observations:
Before the forward() is done, buffer is cleared.
If the response is already been committed, forward() gives
IllegalStateException.

Therefore I find the above statement (my question) false.

What do you say?

Thanks,
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chandra,

You are just reading the question and skipping the intent.

see the question carefully now...

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


meditate.
I am going read the question carefully.
I am going read the question carefully.

 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Srinivasan,

Just have a look at the description that is provided advocating the
correctness of that option:

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



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


Isn't it contradicting?

Thanks,
[ August 12, 2007: Message edited by: Chandra Bhatt ]
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chandra,

I would be pleased if you come up with method call that never returns.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic