• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

RequestDipatcher

 
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys,

Are the following statements correct?

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.

I thought only include() method does that, it returns the servlet and does the rest of the process.

Kindly provide your inputs.
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Atul,

Both include and forward calls by request dispatcher return to the calling servlet but the basic difference is that, before the forward method of the RequestDispatcher interface returns, the response content must be sent and committed, and closed by the servlet container (SRV 8.4) whereas in case of include it is not so. Therefore after forward return you cannot write anything to the output stream since it is already closed however you can do so using include.
 
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rancy,

I would like to know...

After executing forward and getting back control
what actually the servlet can do (or) supposed to do?
[ May 16, 2007: Message edited by: Srinivasan thoyyeti ]
 
Rancy Chadha
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Srinivasan,

After executing forward and getting back control
what actually the servlet can do (or) supposed to do?


I don't think calling servlet is supposed to do anything compulsarily after the forward call returns. But what it can do is, write to logs, write to console, set context attributes.
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rancy,

Thank you.
 
Atul Sawant
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Rancy!
 
Anderson gave himself the promotion. So I gave myself this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic