2.3.1 Web, Tomcat, publish project method, use tomcat in idea

table of Contents

An overview of web knowledge

1.1 Software architecture

1.2 Web server function

1.3 Classification of resources

1.4 URL request path

1.5 Common web servers

Two Tomcat server [Key points]

2.1 Tomcat use

2.1.1 Download

2.1.2 Installation

2.1.3 Directory structure

2.1.4 Startup and shutdown

2.1.5 Start-up error report [experience value]

① Java environment variables

② Port 8080 is occupied

③ Visit test

2.1.6 Three ways to publish a project

① Webapps deployment (the simplest)

② server.xml deployment (understand)

③ Independent xml deployment (used during development)

2.2 Using Tomcat in Idea [The most important thing...]

2.2.1 Configure Tomcat

2.2.2 Create Web Project

2.2.3 Publish Web Project

2.2.4 Hot update of page resources

2.2.5 Experience sharing


 

 

An overview of web knowledge

Web (general term for the Internet)
Java Web: It is the use of Java technology to solve the total technology of the related web Internet field. In layman's terms: publish the written code to the Internet, so that all users can access

 

1.1 Software architecture

  • There are many computers in the network, and they directly exchange information, which we call: interaction
  • There are two very typical interaction methods in the process of Internet interaction-B/S interaction model (architecture) and C/S interaction model (architecture)

C/S Architecture
Client/Server Client/Server Client
software must be installed to access server resources.
For example: QQ, PlayerUnknown's Battlegrounds, LOL

 

B/S Architecture
Browser/Server Browser/Server
Access to server resources does not require special client software installation, but directly access server resources through the browser.
For example: Tmall, Jingdong, Zhihu website

 

1.2 Web server function

Developers can publish local == resources == through the web server to the Internet.
Users can access these resources through a browser


1.3 Classification of resources

Resources: Data files in the computer.
Static resources.
For the same page, different users see the same content.
For example: sports news, website portals, etc. Common suffixes: *.html, *.js, *.css
dynamic resources
For the same page, different users may see different content.
For example: shopping cart, my order, etc. Common suffixes: *.jsp, *.aspx, *.php

 

1.4 URL request path

Uniform Resource Locator (Uniform Resource Locator) is a representation of the location of resources on
the Internet. Every file on the Internet has a unique URL.

The full format is as follows

Protocol://domain name:port number/resource location? parameter=value
* protocol, http, https, ftp, etc.
* domain name, domain name or IP address, all of which can access WEB resources
* port number, the program must use the port number to allow Another computer access. The default end of the http protocol: 80
* resource location, used to describe the location of the WEB resource on the server.
* Parameter = value, the data passed by the browser and server interactively

E.g:

Common path (visit Jingdong-laptop)
    https://list.jd.com/list.html?cat=670,671,672

Common path (visit Jingdong spike-computer office)
    https://miaosha.jd.com/category.html?cate_id=29

Common path (visit Lagou-JavaEE)
    http://www.lagou.com

1.5 Common web servers

* Tomcat: Apache is an open source and free web server that supports JavaEE specifications (Servlet/Jsp).

* Jetty: Apache organizes an open source and free small web server that supports the JavaEE specification.

* JBoss: RedHat Red Hat's open source and free web server, supporting JavaEE specifications.

* Glass Fish: Sun's open source and free web server, supporting JavaEE specifications.
---------------------------------- -----------------------------------

* WebLogic: Oracle's charged web server supports JavaEE specifications.

* WebSphere: A web server charged by IBM that supports the JavaEE specification.

JavaEE specification

In Java, all server vendors must implement a set of interfaces specified by Oracle Corporation. These interfaces are called JavaEE specifications.
Java Web servers of different vendors implement these interfaces, and there are 13 specifications in JavaEE. The more specifications implemented, the stronger the function.

 

Two Tomcat server [Key points]

2.1 Tomcat use

2.1.1 Download

Tomcat official website download address: https://tomcat.apache.org/download-80.cgi

 

2.1.2 Installation

Green free installation version, ready to use after decompression (note: no Chinese path)

 

2.1.3 Directory structure

 

2.1.4 Startup and shutdown

== In the tomcat black window crtl + c twice, which means normal shutdown

 

2.1.5 Start-up error report [experience value]

① Java environment variables

Phenomenon: The black window flashes by (less than half a second)

Solution:
Configure the Java environment variable
JAVA_HOME
Path

 

② Port 8080 is occupied

Phenomenon: An error is reported during startup (the black frame will be closed after waiting for a while)

 

Brute force: find the process corresponding to the occupied port number, kill the process
cmd command: netstat -ano | findstr "8080"

Go to task manager, find it, kill it

 

Gentle: Modify the Tomcat port number.
Enter the Tomcat installation directory/conf/server.xml file to modify
== Note: If other software occupies 8080, you can directly modify this one...==

==Note: If you want to start multiple tomcats, you need to modify two port numbers ==

Port number: personal designation range: 1024~65535, as long as it does not rush into other software

 

③ Visit test

Note: If it is port 80, you can omit it

 

 

2.1.6 Three ways to publish a project

① Webapps deployment (the simplest)

Place directly under the webapps directory

==This kind of scheme (supports hot update) is generally used after development. . . . ==

 

② server.xml deployment (understand)

Find the Host tag in tomcat/conf/server.xml and add the tag context

Disadvantages
1. After the configuration file is modified, it needs to be restarted to take effect...
2. server.xml is the core configuration file of tomcat. If there is a slight mistake in operation, the entire tomcat will fail to start
.

 

③ Independent xml deployment (used during development)

Create an xml file in the tomcat/conf/Catalina/localhost directory and add tags

The file name is the virtual path

 

2.2 Using Tomcat in Idea [The most important thing...]

2.2.1 Configure Tomcat

Click again to confirm whether the configuration is successful.

 

2.2.2 Create Web Project

 

 

2.2.3 Publish Web Project

 

2.2.4 Hot update of page resources

 

2.2.5 Experience sharing

Guess you like

Origin blog.csdn.net/chengh1993/article/details/109718875