How to set the context path of a web application in Tomcat 7.0

后端 未结 13 1348
傲寒
傲寒 2020-11-21 23:34

I know that I can rename my webapp (or it\'s WAR file) to ROOT but this is a terrible way to do it, IMHO. Now I checked out the tomcat doc & it says

相关标签:
13条回答
  • 2020-11-22 00:04

    Tomcat 8 : After many searches this is only working code: in server.xml

    <!-- Set /apple as default path -->
        <Host name="localhost"  appBase="webapps"
             unpackWARs="true" autoDeploy="true">
         <Context path="" docBase="apple">
             <!-- Default set of monitored resources -->
             <WatchedResource>WEB-INF/web.xml</WatchedResource>
         </Context>
        </Host>
    

    Restart Tomcat, make sure when you access 127.0.0.1:8080, it will display the content in 127.0.0.1:8080/apple

    My project was java web application witch created by netbeans ,I set context path in project configuration, no other thing, even I put apple.war in webapps folder.

    0 讨论(0)
提交回复
热议问题