Basic knowledge Review Article 2 tomcat and web Application Deployment, Article 2 tomcat

Source: Internet
Author: User

Basic knowledge Review Article 2 tomcat and web Application Deployment, Article 2 tomcat

Preface this article describes some of the attributes of tomcat and the simple deployment of web programs, which may be a better deployment method in actual development, but it is also a basis.

1: tomcat

We all know that tomcat requires a runtime environment, that is, Servlet containers, tomcat is a free open-source Servlet container. If you have developed. net, you should know IIS. In fact, both tomcat and IIS have the ability to process HTMl pages. Of course, they can also process Servlet and jsp pages.

The following is a process in which the tomcat server receives and responds to client requests.

2: A simple Applet

Below is a simple program I wrote to deploy it in tomcat

1 <% @ page language = "java" contentType = "text/html; charset = UTF-8" 2 pageEncoding = "UTF-8" %> 3 <! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" http://www.w3.org/TR/html4/loose.dtd "> 4 Then, compress the project into a war package and place it directly under the webapps in tomcat.

Let's take a look at the tomcat directory.

Then, call bin and run startup. bat. Open the http: // localhost: 8080/web-deploy/index. jsp file, and the expected results will be displayed.

Another deployment Method

Create an xml file in conf \ Catalina \ localhost with the same name as your web application and add

<Context path = "/web-deploy" docBase = "C: \ 91 \ web-deploy" reloadable = "true"/>

Path specifies the context path of the web program, and docBase specifies the root directory reloadable = true of the web program, which means that the changes to the files in the classes file and lib will be monitored for automatic updates, then, the results are the same.

Of course, you can modify your port number by modifying the port in server. xml.

3: Summary

There is nothing in this article to help you remember, but a web Container can have multiple web applications, but their context is unique. The context is your application name.

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.