File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher doubt

 
Lalit mishra
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Consider the following code snippets. What will be displayed on the browser when a GET request is sent to FirstServlet assuming that the buffer is large enough to hold all the data before sending the data to the client?


what will be the output of following code
 
Vepa Sritej
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess Page 2 will be displayed , the buffer from the first servlet will be cleared..
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it should be just "<br>Page 2</body></html>" - you might find this other thread useful:

What is allowed after forward()?
 
Michael Ku
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RequestDispatcher rd = response.getRequestDispatcher("SecondServlet");



You cannot get a RequestDispatcher from a response...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic