The ServletContext and ServletRequest objects both contain methods to retrieve a RequestDispatcher instance. ServletContext methods require an absolute URL. ServletRequest methods can interpret a relative URL. Both URL types must follow these guidelines:
The path cannot include the context.
Mappings must agree with the servlet mappings defined for the Web application—if a mapping does not exist, use the static page in the Web applications’s context root directory $JAGUAR/Repository/WebApplication/<web-app-name>.
You must resolve dots in the path before mapping the URL.
There can be no static content access at WEB-INF/META-INF.
A ServletContext.getRequestDispatcher URL must begin with a forward slash (‘/’). If a ServletRequest.getRequestDispatcher URL begins with a forward slash, the servlet engine interprets it as an absolute URL. Otherwise, the servlet engine appends the relative URL to the current request’s URI path. For example, if the current request is /catalog/garden.html and the relative URL is sports.html, then the new URL is /catalog/sports.html.
Copyright © 2005. Sybase Inc. All rights reserved. |