JavaWeb - Tomcat server

Table of contents

1. What is Java Web?

2. Common web servers

3. Tomcat Tutorial

3.1. Download and install Tomcat

3.2, Tomcat directory structure

3.3. Tomcat startup and shutdown

3.4, garbled problem solving

3.5. Modify the port number

3.6. Check the Windows port occupancy

4. Tomcat release project


 

1. What is Java Web?

Java Web is a technology stack that uses Java technology to solve related web and Internet fields. The web includes two parts: the web server and the web client . The application of Java on the client side includes Java Applet, but it is rarely used . The application of Java on the server side is very rich, such as Servlet , JSP , third-party frameworks , and so on. Java technology has injected a powerful impetus into the development of the Web field. Quoted from Baidu Encyclopedia

2. Common web servers

1. Tomcat: A web server provided by the Apache organization, providing support for Jsp and Servlet. This is a lightweight Java web server and is currently the most widely used java web server.

2. JBoss: It is an open source, pure java web server that complies with the JavaEE specification.

GlassFish: A javaweb server by Oracle Corporation, which is a robust business-compatible application server. At production quality, free for development, deployment, and redistribution, but not very widely used.

3. Resin: It is a product of CAUCHO Company, and it is a very popular application server. It provides good support for servlet and JSP.

4. Weblogic: It is a product of Oracle Corporation. It is currently the most widely used web server, supports JavaEE specifications, and is constantly being improved to meet new development requirements and is suitable for large-scale projects.

5. WebSphere: It is a software produced by IBM. It consists of authoring, running and monitoring 24/7 industrial-strength on-demand Web applications and cross-platforms, and a middleware infrastructure such as servers, services, and tools required for product solutions: Supports JavaEE Specifications, suitable for large projects.

3. Tomcat Tutorial

3.1. Download and install Tomcat

Login URL: Apache Tomcat® - Welcome!

You can see that different versions of tomcat are provided in the selection box on the left, and you can choose to download by yourself 

After selecting the version, choose to download in the red box below, zip is the compressed package, tar.gz is the version stored in the Linux system, 32-bit Windows.zip and 64-bit Windows zip are the versions downloaded by the Windows system, according to your own Computer performance to choose to download. 

Here is a stable and highly used version tomcat-8.5.77 compressed package, please download and decompress it yourself

Link: https://pan.baidu.com/s/1-8AEyNbpdS1kyhEM3jFUdw 
Extraction code: rm0i

3.2, Tomcat directory structure

3.3. Tomcat startup and shutdown

open method

Open the bin directory 

  Double-click startup.bat, if the following log appears, and the last line of Server startup in xxxms, it proves that the startup is complete.

Open the browser and enter http://localhost:8080 in the address bar to visit. If the following screen appears, it proves that Tomcat has started successfully.

Closing method

Method 1: Directly click the x in the upper right corner to close.

Method 2: Double-click shutdown.bat to close.

3.4, garbled problem solving

If there is a problem of Chinese garbled characters in the log information when starting the Tomcat service, you need to modify the configuration file

Open the conf directory

Open the logging.properties configuration file with notepad++ Notepad

 Change the utf-8 behind the code below to GBK.

3.5. Modify the port number

Tomcat's default port number is 8080. If you don't want to use port 8080, you can change it to another port number, but the premise is that it must be a port number that is not used by other software, otherwise there will be an exception of port number conflict.

Modify the port number in the connector label to 8081 (here for testing to 8081, other ports are also available) 

Restart the Tomcat server, and you can find that when you access 8081, you can access the tomcat webpage.

3.6. Check the Windows port occupancy

If the port is occupied and you don’t know which application is occupying it, you can directly find the occupied application and close it. Enter
in the command line: netstat -ano  
pid represents a process number, and you can find the corresponding process through this number program

 Open the task manager, click the detailed information to find the corresponding pid, and end it

4. Tomcat release project

Open the webapps directory, create a test test package in the directory,

 Create a new notepad, add the content as hello tomcat, and modify the notepad file to html suffix.

restart the tomcat server

Enter the /test/hello.html address in the address bar, you can see that the page access is successful

Guess you like

Origin blog.csdn.net/select_myname/article/details/126842134