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

Mutiple forward() calls

 
sajith pc
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi all,

I have jsp page which uses the RequestDispatcher.forward() method multiple times.

I am using the apache tomcat 6.x version as my server. I have three deployments in the named test1,test2,test3.

For a particular http request i need to pass to all the three deployments.

For that i wrote a jsp page put it under the webapps/ROOT/testfporward.jsp



While executing this i am getting the following error.
"cannot forward after response has been committed"

Is there is anything wrong in my code.
Which is correct way to invoking multiple http requests for a incoming request?
Please help me to solve this issue..
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What, precisely, are you trying to do? Include three other pages?
 
sajith pc
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the quick reply.
No, i am not trying to including files.

I want to pass the HttpServletRequest to other three deployments in the server.

testforwrad.jsp get external http request, then i want to pass this request to all the three deployments test1,test2,tset3

Is this possible..
please help me
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you can't forward a request once any output has been written to the client.

I suppose you could create a bunch of requests using a client library like Apache's HttpClient, but the purpose of what you're doing eludes me.
 
pankaj vijay
Ranch Hand
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not possible to forward a request if one is all ready commited.. yes you can do 1 thing put if & else in such a way that at a time only one request can be forwarded...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"sajith pc", please check your private messages for an important administrative matter.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic