wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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: 3254
    
    2
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
 
Similar Threads
Dispatching from Servlet to html file, images not found
J2EE Authentication
Request-dispatching in a POJO
Thread safety - Request Dispatching
Forwarding to a URL outside the container