Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes dispatching requests to servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "dispatching requests to servlets" Watch "dispatching requests to servlets" New topic
Author

dispatching requests to servlets

Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
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

Joined: Sep 23, 2000
Posts: 3285
    
    7
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.


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dispatching requests to servlets