How can I define search paths for jsp files? In the server.xml context I can only define one docbase. I would like to have one custom path and one default path. If the files are not found in the custom path then the files in the default path should be used.

Serge Knystautas

Web servers in general are not designed to handle anything like this. URLs are mapped to a single handler, and if the resource cannot be handled by that handler, it will return a 404.

You can accomplish this though using a servlet that invokes (forwards) the appropriate JSP. Your servlet would map your request URI to one of a series of possible doc paths, and if the file exists, you could forward it to that JSP with the appropriate real path. The disadvantage to this though is that the JSPs will also have to reside at different URIs on the web server. JSP compilers in general are not able to handle multiple file names with the same URI, unless they are within different servlet contexts (which would create other headaches for you because application and session data would not pass across servlet contexts).

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact