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.