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 RequestDispatcher to one web app to other web app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "RequestDispatcher to one web app to other web app" Watch "RequestDispatcher to one web app to other web app" New topic
Author

RequestDispatcher to one web app to other web app

Ritesh raushan
Ranch Hand

Joined: Aug 29, 2012
Posts: 100

problem in forwarding the request from one web application to other web application
what's wrong with my code


this class takes request from Test servlet and gives response to Client

Harsha Ka
Ranch Hand

Joined: Mar 14, 2010
Posts: 45

I believe it is not possible to forward a request from one web application to another, but only use


SCJP 1.6,Preparing (Tryin to prepare) for scwcd
Ayan mallick
Ranch Hand

Joined: Nov 17, 2012
Posts: 44


we have to use relative path i.e "/contextpath" when using other application context path name inside getContext method as per the specification.
so change will be like ServletContext ctx2=ctx1.getContext("/Best");
and to enable this feature little change needed in server.xml

we need to add this attribute crossContext="true" in project's context element in server.xml.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RequestDispatcher to one web app to other web app