Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher to one web app to other web app

 
Ritesh raushan
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 45
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe it is not possible to forward a request from one web application to another, but only use
 
Ayan mallick
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic