已发布的jsp项目如何在本地展示

已发布的项目可以放到tomcat 安装目录下的webapps/下面,但是有时候我们的目录已经放好了,所在要加映射过去。

1, 到tomcat/conf/下,打开server.xml

2, 找到

<Host name="localhost"  appBase="webapps"

             unpackWARs="true" autoDeploy="true">

         <!-- SingleSignOn valve, share authentication between web applications

              Documentation at: /docs/config/valve.html -->

         <!--

         <Valve className="org.apache.catalina.authenticator.SingleSignOn" />

         -->

         <!-- Access log processes all example.

              Documentation at: /docs/config/valve.html

              Note: The pattern used is equivalent to using pattern="common" -->

         <Valve className="org.apache.catalina.valves.AccessLogValve"            directory="logs"

                prefix="localhost_access_log" suffix=".txt"

                pattern="%h %l %u %t &quot;%r&quot; %s %b" />

</Host>

3, 从这里可以看,默认目录是在webapps, 修改目录指向,添加语名:

 <Context docBase="你项目的绝对地址" path=""               reloadable="true"/>

4, 完整的host

<Host name="localhost"  appBase="webapps"

             unpackWARs="true" autoDeploy="true">

         <!-- SingleSignOn valve, share authentication between web applications

              Documentation at: /docs/config/valve.html -->

         <!--

         <Valve className="org.apache.catalina.authenticator.SingleSignOn" />

         -->

         <!-- Access log processes all example.

              Documentation at: /docs/config/valve.html

              Note: The pattern used is equivalent to using pattern="common" -->

         <Valve className="org.apache.catalina.valves.AccessLogValve"            directory="logs"

                prefix="localhost_access_log" suffix=".txt"

                pattern="%h %l %u %t &quot;%r&quot; %s %b" />

            <Context docBase="******"path=""               reloadable="true"/>

5, 重启tomcat, 先shutup, 再startup

原文地址:https://www.cnblogs.com/qianlizeguo/p/6835478.html