Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dispatching requests to servlets

 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When dispatching requests to servlets using request.getRequestDispatcher("/servlet/servletX") how is the file structure evaluated?? since while using request to get the dispatcher the current location of the request is important...

for example:
context: catalog
current request: catalog/user/create.jsp
What happens if I try to dispatch the request to the path "/servlet/servletX"?? what happens if I try to dispatch the request to the path "servlet/servletX"??
thanks, in advance...
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3713
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you give a relative path (one that does not start with /)such as getRequestDispatcher("hello.jsp"), the the path of the current jsp is important. In this case, hello.jsp has to be inthe same directory as the current jsp. Otherwise, the path is evaluated from the document root and does not depend on the path of the current jsp.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic