eclipse create server to config tomcat

1. modify tomcat server.xml file,link web directory to workspace directory. Refer red color font comments.

    

  <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

        <!-- 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 -->
        <!--
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" 
               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
        -->
        <Context docBase="F:/study/workspace/testwe/WebContent/" path="/testweb" reloadable="true"/>
      </Host>

2. Set JAVA_HOME envirement parameter to tomcat startup.

Explain

contex指上下文,实际上就是一个web项目;
path是虚拟目录,访问的时候用127.0.0.1:8080/testweb/*.jsp访问网页,testweb前面要加/;
docBase是网页实际存放位置的根目录,映射为path虚拟目录;
reloadable="true"表示你修改了jsp文件后不需要重启就可以实现显示的同步。

猜你喜欢

转载自fgsh.iteye.com/blog/697387