• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher

 
Sam Cala
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we include from / forward to a recsource in difference context but in the same web server using include() / forward()
 
Ricardo Cortes
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the search function at the top right of this page and search for the word "RequestDispatcher". There are some good threads regarding this very subject...
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes.
ServetContext otherCtx = getServletContext().getContext("anotherContext");
RequestDispatcher rd = otherCtx.getRequestDispatcher("jspor servlet");
rd.forward() ;
Originally posted by Sam Cala:
Can we include from / forward to a recsource in difference context but in the same web server using include() / forward()
 
Zakaria Haque
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by pradeep bhat:
yes.
ServetContext otherCtx = getServletContext().getContext("anotherContext");
RequestDispatcher rd = otherCtx.getRequestDispatcher("jspor servlet");
rd.forward() ;

ServletContext.getContext("anotherContext") may return null for security reasons depending on the appserver. So, this may not work in all cases.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic