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: http://www.baidu.com
B: First www.baidu.com 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 www.baidu.com to 126.96.36.199
D: Establish a connection based on IP, send a request to port 80 of 188.8.131.52, 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 Www.warrior.com, 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:
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.
IV: Other ISSUES
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.
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)