Sometimes you need to do a special configuration in Tomcat to access it:
For example your program name is Hello port is 80 this time you want to access your program will use Localhost/hello to access.
But how to access it directly with localhost? We need to configure Tomcat.
Look at the following configuration: Tomcat inside the Conf server.xml the bottom
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= "Webapps/hello" path= "/hello" reloadable= "true" ></Context>
<context docbase= "Webapps/hello" path= "/" reloadable= "true" ></Context>
<context docbase= "Webapps/cas" path= "/cas" reloadable= "true" ></Context>
</Host>
Here originally with the appbase is the value of WebApps here means that the load WebApps all the items below, equal to the items you put into the WebApp will be loaded, (here I will not write I wrote a configuration to let him load)
Then you can write your own context to write your project, Docbase can write absolute address can also write relative address, relative address is relative to your tomcat, here is written as Webapps/hello meaning is webapp below the Hello;
Here's the question of loading two times when you start up. When you write WebApps in AppBase, he will automatically load all of them and then load your configuration. So you don't want him to load two times and you can write nothing in appbase.
However, this will encounter a problem, when I use struts jump, you find that you do not configure <context docbase= "Webapps/hello" path= "/hello" reloadable= "true" ></ Context> this time your project will not find Struts return page, this is the disadvantage, you want to access the project by not entering the project name, but your program will not find the result, so you have to write the original mapping, so that you visit the home page is through <context Docbase= "Webapps/hello" path= "/" reloadable= "true" ></Context> this access, but some of the jumps inside are based on <context docbase= " Webapps/hello "path="/hello "reloadable=" true "></Context> he came to jump. So it was loaded two times,. It's up to you to decide on your project.
Tomcat Server.xml Context Configuration