Tomcat Installation Tutorial
1. Double-click the. exe installer to display the Welcome page as shown in the following illustration.
2. Click Next button to appear as shown in the following image page
3. Click I agree to go to the next installation step, click Next to press the button to go to the next step.
>
4. If you want to change the installation path for Tomcat, you can do so by clicking the browse button. Click the Next button to continue the installation.
5. Set the port, the default 8080, if the selection is occupied, User name Administrator name Password Administrator password, this page so options are selected by default, click Next to enter the next step. This step is important, please select the path to the JVM installed on your system: If you find the JDK path automatically (such as c:j2sdk1.4.2) then you can definitely install successfully, if you can't find it, do not continue, please Choose to set the JAVA_HOME environment variable, if you can clearly remember after the installation is complete you go to configure Java_home so also can.
6. Click on the Install button to install, and finally click on the completion of the button to complete the installation.
Tomcat Configuration Tutorial
After the Tomcat installation is complete, modify the following files:
installation directory (for example, C-disk)
C$program Filesapache Software Foundationtomcat 8.0confserver.xml
1) Locate the host label and add the following
The code is as follows |
Copy Code |
<context path= "/" reloadable= "true" docbase= "" workdir= ""/> " </Host> |
2 Locate the following directory and create the new host using the directory Mobilebi and create the application required files under the directory
C$program Filesapache Software Foundationtomcat 8.0 and create a new subdirectory Mobilebi
Set up Web-inf, JSP, JPG, JS, etc. in Mobilebi subdirectory to store different files
3 Create web.xml files and classes directories under Web-inf subdirectory
The following structure is eventually formed:
The code is as follows |
Copy Code |
C$program Filesapache Software Foundationtomcat 8.0 +conf Server.xml (add host configuration) +mobilebi +web-inf +classes (The directory holds the class package name Class name) Web.xml (configuring Servlet mappings) |
------------------------------------
The case is as follows:
1) server.xml Add host
The code is as follows |
Copy Code |
<context path= "/" reloadable= "true" docbase= "" workdir= ""/> " </Host> |
2) Web.xml Configuration
The code is as follows |
Copy Code |
<?xml version= "1.0" encoding= "Iso-8859-1"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more Contributor license agreements. The NOTICE file distributed with This is work for additional information regarding copyright ownership. The ASF licenses this file to your under the Apache License, Version 2.0 (the "License"); You are not to use this file except in compliance with The License. You could obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable or agreed to in writing, software Distributed under the License is distributed on ' as is ' basis, Without warranties or CONDITIONS of any KIND, either express or implied. The License for the specific language governing permissions and Limitations under the License. --> <web-app xmlns= "Http://xmlns.jcp.org/xml/ns/javaee" Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" Xsi:schemalocation= "Http://xmlns.jcp.org/xml/ns/javaee Http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd " Version= "3.1" Metadata-complete= "true" >
<!--Define Servlets that are included in the example application <servlet> <servlet-name>Servlet1</servlet-name> <servlet-class>biServlet.SaleArea</servlet-class> </servlet> <servlet-mapping> <servlet-name>Servlet1</servlet-name> <url-pattern>/sale/area</url-pattern> </servlet-mapping>
<servlet> <servlet-name>Servlet2</servlet-name> <servlet-class>biServlet.SignMoney</servlet-class> </servlet> <servlet-mapping> <servlet-name>Servlet2</servlet-name> <url-pattern>/sale/signMoney</url-pattern> </servlet-mapping> </web-app> |