1. server.xml configuration file for Tomcat
Added in the <Host> tab of the Tomcat configuration file conf/server.xml file <Context> labels can mark the current Web Application , the application is loaded with the system boot, such as:
<context path= "" docbase= "E:\TestPro\WebRoot" reloadable= "true" > </Context>
This is said that the path property is marked as empty, access to the system without adding the project name, can be directly accessed, development and debugging more convenient. <Context>represents a run on<Host>on the individualWebapplication, a<Host>can have multiple<Context>elements, eachWebthe application must have a uniqueURLpath, thisURLPath in<Context>the properties inPathset in.
<Context> elements of eachPropertiesthe meaning:
1)Path:Specifies the URL entry to access the Web app .
2)docBase:Specifies the file path for the Web app, either given an absolute path or given a relative path to the appBase Property relative to <Host> , if the Web app is in an open directory structure, specify the Web app's root directory, if the Web app is a War file, specify The path to the war file.
3)reloadable:If this property is set to true, TomcatThe server monitors changes to class files in the web-inf/classes and web-inf/lib directories while running. If a class file is detected to be updated, the server will automatically reload the Web app.
2. Configuring JNDI in Tomcat
If you are using JNDIin development, there are two ways to put database information into a container for hosting:
1) add <Resource> tag in conf/server.xml
<context path= "" docbase= "E:\TestPro\WebRoot" reloadable= "true" > <resource name= "dbtest" Auth= "Container" type= "Javax.sql.DataSource" driverclassname= "Oracle.jdbc.driver.OracleDriver" url= " JDBC:ORACLE:THIN:@192.168.16.23:1521:ORCL " username=" test "password=" 1234 "maxactive=" "maxidle= " maxwait= "-1"/></context>
2) add <Resource> tag in conf/context.xml
Similar to the above, the contents of the Resource tag are added to the context tab
The difference between the two approaches is that the first is valid only for the application that corresponds to the current Context, and the second is valid for all applications in the entire container.
3. invoking JNDI in Java
/span>
Configuring Jndi in Tomcat