aspose file tools*
The moose likes JSP and the fly likes Mutiple forward() calls Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Mutiple forward() calls" Watch "Mutiple forward() calls" New topic
Author

Mutiple forward() calls

sajith pc
Greenhorn

Joined: Oct 05, 2009
Posts: 2

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

Joined: Sep 29, 2008
Posts: 12617

What, precisely, are you trying to do? Include three other pages?
sajith pc
Greenhorn

Joined: Oct 05, 2009
Posts: 2
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Apr 01, 2008
Posts: 75
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...


Pankaj Vijay (SCJP, SCBCD)
Learn Core Java,Learn Servlet Jsp, SCJP Questions,Struts Tutorial
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61434
    
  67

"sajith pc", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mutiple forward() calls