File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes talking across war files Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "talking across war files" Watch "talking across war files" New topic
Author

talking across war files

Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 409
I have two servlets deployed in different war files but on the same container.I want to forward the control from first servlet to second servlet.I have got only two ways to do this,that are :

response.sendRedirect("complete url of second servlet")
response.sendRedirect("/contextrootofsecondservlet/urlofsecondservlet")

Earlier i thought,it can be done through RequestDispatcher also but it is not happening through RequestDispatcher.
Can anyone tell me apart from these 2 ways,how can i make those 2 servlets to talk with each other.
Thanks.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Check the API for ServletContext.getContext(String uripath)
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

For security reasons, some containers shut this capability off by default.
With Tomcat, for instance, you need to set the crossContext attribute to true in your <Context ../> entry.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: talking across war files
 
Similar Threads
call servlet files from different war
Servlet - doGet - doPost - parameter
Distributed applications
dispatching to servlets and JSPs
WLS do not display images. !!Urgent!!