This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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


Win a copy of Building Microservices this week in the Design forum!
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: 46


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.
 
Have you checked out Aspose?
 
subject: RequestDispatcher to one web app to other web app
 
jQuery in Action, 3rd edition