Tomcat Getting Started Guide

Source: Internet
Author: User

Recently in the work, see some of the basic information of Tomcat, feel good. At the same time also recalled that they have just graduated to participate in the work that will be a variety of Tomcat is also a variety of information, it is not easy. To this end, according to some recent consolidation of some foundation, the Tomcat basic configuration comb, hope to be able to beginners tomcat friend helpful.

Tomcat official website: http://tomcat.apache.org/First, TOMCAT operating environment construction1. Tomcat boot needs to double-click the Startup.bat run under the bin directory. 2. If the Java environment variable is not configured, the boot will only flash through, that is, Tomcat cannot find the JDK or JRE. 3. Configuring the Java Environment3.1, the first method, the most common configuration method (here I have also configured the JAVA development environment). in the System properties, configure the environment variables that you want. 3.1.1, configure Jre_home to point to the JRE installation directory, such as:D:\MyProgram\Java\jre7. 3.1.2, configure Java_home to point to the JDK installation directory, such as:D:\MyProgram\Java\jdk7. 3.1.3, add%java_home%\bin to the Path variable name ; let's make a command to test if the JDK is properly installed. c:\users\admin>java-version;unrecognized option:-version;error:could not create the Java Virtual machine.ERROR:A Fatal exception has occurred. Program would exit.3.1.4, configure catalina_home to point to the extracted directory of Tomcat, for example:D:\apache-tomcat-7.0.65. //========================================================================================================= =====================3.2, the second method, relative to the first to offset some of the configuration method. 3.2.1, edit startup.bat file, add set jre_home= "JRE installation directory"under Setlocal, for example: Set Jre_home= "D:\MyProgram\ Java\jre7 ". 4, Tomcat is configured, start Tomcat, enter http://localhost:8080/in the browser address bar, you will see the Tomcat aspect. Second, modify the Tomcat Default Web site path1. The Tomcat default website is under the Tomcat installation path /webapps . 2, in the Tomcat installation path /conf/server.xml, search WebApps.  3, in <context path= "" docbase= "D:/myweb" debug= "0" reloadable= "true" crosscontext= "true" />.  4, in D:/myweb new index.jsp file, open the browser, enter the address to test. Iii. Changing the Tomcat port and encoding1. The Tomcat default port is 8080. 2, in the Tomcat installation path /conf/server.xml, search 8080, modify the port you need 3, set the code, add in the Connector label usebodyencodingforurl= "true" //Set POST and GET using the same encoding uriencoding= "UTF-8" //URI using UTF-8 encoding processing 4, in D:/myweb new index.jsp file, open the browser, enter the address to test. Iv. Setting up the site1, the site is a folder with a specific structure. This is a very clear expression in Tomcat. 2, the site, on the server is definitely a folder (that is, directory structure) to store and manage. However, it is different from the normal folder, in Tomcat, the folder that can be used for the site must have the following characteristics:2.1. Have a subfolder named Web-inf . 2.2. The Web-inf folder must have a file named Web. XML . 2.3. The Web. xml file must be constrained with a specific DTD. 3. Project Access Address:3.1, Tomcat default access to the WebApps directory, if the site is stored in the WebApps directory, you can use the relative path: http://localhost:8080/myweb. 3.2. When you modify the Tomcat Default Web site path, for example, open the Server.xml under conf: at this point the access address for the specified site directory is: http://localhost:8080.

Tomcat Getting Started Guide

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.