One, Tomcat download
Official website http://tomcat.apache.org/ Download zip-mode files.
Ii. installation of Tomcat
1, ensure that the system variable has java_home, the value is JDK6 installation directory, such as "D:\EngineerSoftware\java_jdk\Java\jdk1.7.0_67".
2. Unzip the downloaded zip mode of tomcat into the specified directory, such as "D:\EngineerSoftware\java_tool\apache\apache-tomcat-7.0.47".
The bin directory is the executable file that is often required to use the executable file that is the start, Stop batch command file. The start command in Windows is Startup.bat, and the Stop command is Shutdown.bat.
Under the Conf directory are some configuration files and parameter files about the Tomcat server.
The Lib directory is used to hold some class libraries and resource files that are common to Web applications in Tomcat.
The work directory is a temporary working directory that is used by the Web app and can be deleted, but this file is generated when the app is not created.
Temp directory for the JVM to use for temporary files.
The WebApps directory is used to hold some tomcat auto-loaded web apps, which can be the entire directory of Web applications, where root is the default root Web App.
Third, configure the Web service port number
The Tomcat Default Web service port number is 8080.
How to modify: Open the Server.xml file in the Conf subdirectory under the Tomcat installation directory and navigate here:
<connector port= "8080" protocol= "http/1.1"
connectiontimeout= "20000"
redirectport= "8443"/>
Simply change the value of the Port property to the corresponding port, generally select more than 1024 ports, because the HTTP default port is 80, can also be set to 80 port.
Iv. Tomcat Web-mode management
The URL to access the Admin Web App is http://localhost:8080/manager/html.
User name and password settings: Open the Tomcat-users.xml file in the Conf subdirectory of the Tomcat installation directory, as follows:
<tomcat-users>
<role rolename= "Tomcat"/>
<role rolename= "Role1"/>
<role rolename= "Admin-gui"/>
<role rolename= "Manager-gui"/>
<role rolename= "Manager-script"/>
<role rolename= "Manager-jsm"/>
<role rolename= "Manager-status"/>
<user username= "Tomcat" password= "Tomcat" roles= "Admin-gui, Manager-gui, Manager-script, MANAGER-JMS, Manager-status "/>
<user username= "Both" password= "Tomcat" roles= "Tomcat,role1"/>
<user username= "Role1" password= "Tomcat" roles= "Role1"/>
</tomcat-users>
all Web Apps in Tomcat are listed in the Applications table, and in the Commands column of the table there are some central management commands for each Web app:
Start to start the web App
Stop for stopping web apps
Reload for overloading Web applications
Undeploy for undoing web apps
The text box after the "Expire Sessions" button is used to fill in the session timeout for this web app, which defaults to 30 minutes and then clicks the "Expire Sessions" button to take effect.
V. Publishing Web applications
Method One:
1. Create a new file in the WebApps subdirectory in the Tomcat directory, named after the service name
2. Create a new Web-inf folder
3. Create a new classes--to hold the compiled class file, Lib folder--place the introduced jar package, Web. xml file--placement configuration information
Method Two:
Open "Conf/server.xml" with the editor and add the following before "</Host>":
<context
<!--Configure the virtual directory name, which is also the service name--
Path= "/jsp_1"
<!--virtual directory points to the actual directory--
docbase= "E:\javaweb\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\wtpwebapps\JSP_1" >
</Context>
Method Three:
Create a new XML file with the same name as the Web app, such as "Jsp_1.xml", under the "Conf/catalina/localhost" subdirectory of the Tomcat installation directory.
<context
<!--Configure the virtual directory name, which is also the service name--
Path= "/jsp_1"
<!--virtual directory points to the actual directory--
docbase= "E:\javaweb\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\wtpwebapps\JSP_1" >
</Context>
Three ways Tomcat publishes the web