Javaweb Learning Summary 17 (Web application organization structure, website XML role and configuration web hosting site)

Source: Internet
Author: User
Tags hosting web hosting tomcat server

One: Web application Organization structure

1:web Application Composition Structure

2: Install Web Components to manually create a Web application catalog

A: Create a directory Web under WebApps

B: In the WEB directory to create HTML, JSP, CSS, JS, Web-inf and other directories and index.html access to the home file

C: Write the corresponding file in HTML, JSP, CSS, JS directory, create classes, Lib and Web. xml file in Web-inf directory

D: Start the server, access:

Default Access index.html

If you set the Web as the application that the server is accessing by default, you only need to access localhost:8080, in the Server.xml file, under the host element

<context path= "" docbase= "F:\apache-tomcat-6.0.45-windows-x86\apache-tomcat-6.0.45\webapps\web" ></ Context>

The pAth property is set to "", Docbase depends on its path, restarts the server, and then accesses:

If the connector port is modified by 80, then the access address can be localhost

II: The role of the Web. xml file

1: Website Home


2: Map the servlet program to a URL address


Map all *.do requests to the Org.springframework.web.servlet.DispatcherServlet class

3: Configure the Listener

<listener></listener> specific format can be Baidu

4: Configure filter filters

Three: Configure the virtual host site to build

1: The process of user input URL to get information

A: The user enters the URL in the browser address bar, for example:

B: First this hostname will look for IP in the Hosts file under C:\Windows\System32\drivers\etc path under Windows

Match the IP to the host name. Locate on the direct access, if not found on the Access DNS server.

C: For example, the DNS server obtains the IP of to

D: Establish a connection based on IP, send a request to port 80 of, and if you have already configured the default Web app, you will have direct access to the Web App.

The E:web application processes the request, then returns the response, and the browser renders the response data, which is presented to the user.

2: Build a website locally

A: Create a Web application on the E: disk, set the access page to index.html


B: Configure the <Host> element in Server.xml, named, to access the Web application by default

<context path= "" docbase= "E:\web"/>

C: Set the host name and IP mappings in the Hosts file

All OK, then restart the service, visit:

Access Success!

If you want to publish your Web application to the Internet and allow users from other cities to access it, you need to purchase a domain name and register it on DNS

Binds the domain name to the IP address of its host.


1:web resource access process can refer to the third section to configure the virtual host

2: Package The Web application war, the server will automatically extract the war package, packaging, CD Web application directory, JAR-CVF Web.war web

Just copy the war package to the WebApps directory and the server will automatically decompress.

3: Configure the context element Reloadable property, configure this property to be loaded automatically after modifying the Web app, if the Web app is relatively small

Can be used, if the Web application is relatively large, is not recommended to use, it is easy to cause memory overflow.

4:tomcat Architecture

When the Tomcat server starts, start the server first, then start a service,service with multiple connectors, and then find the engine that is found through the engine

The host (which is the host name that was taken on the request) and then find an app. The architecture can refer to the Server.xml file in the Conf directory.

Javaweb Learning Summary 17 (Web application organization structure, website XML role and configuration web hosting site)

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.