How can I use a different JSP directory than webapps for Tomcat?

How can I put JSP files in a directory other than /webapps/ when I use the Tomcat 3.2 container?
Answer:
The documents under Tomcat’s doc directory describe how you can configure Tomcat the way you want, but here’s a brief answer.Edit the conf/server.xml file and add an element like this for top level directory you want to store the JSP files in:

<Context path="/myapp"
  docBase="C:/websites/myapp"
  crossContext="false"
  debug="0"
  reloadable="true" >
</Context>

Note, however, that the directory you specify as docBase must contain the complete web application directory structure, i.e. the WEB-INF directories as well as the JSP pages (see Chapter 2, 4 and Appendix D in the book for more info).

You need to restart Tomcat for this change to take effect.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>