Tomcat Server Getting Started Super Detailed Tutorial

Tomcat Server Getting Started Super Detailed Tutorial

1. Some concepts of Tomcat

–1, Server

Server: Divided into server hardware and server software. Only after the server software is installed on the hardware server (actually a computer) can services be provided to the outside world.
1. Hardware: usually refers to a computer with an independent IP on the Internet, usually with a relatively high configuration. For example, our own computer can also be used as a server (but the configuration is lower)
2. Software: It is a computer program, such as MySQL server software and tomcat server software. Server software is divided into many types, such as: ftp server, database server, mail server, web server software, etc.

–2, web server

A computer program accessed through a browser. When the server receives your access request, it processes it and responds.

–3, Tomcat server

Tomcat is a core project of the Jakarta project of the Apache Software Foundation. Because of its advanced technology, stable performance, and free, Tomcat is deeply loved by Java enthusiasts and recognized by some software developers, becoming a popular Web application server.
Tomcat server is a free and open source Web application server. It is a lightweight application server and is widely used in small and medium-sized systems and in situations where there are not many concurrent users. It is the first choice for developing and debugging JSP programs. For a beginner, you can think of it this way: when the Apache server is configured on a machine, it can be used to respond to access requests for HTML (an application under the standard universal markup language) pages. In fact, Tomcat is an extension of the Apache server, but it runs independently at runtime, so when you run tomcat, it actually runs separately as a process independent of Apache.

Second, use Tomcat

–1, Download and install

No need to install, just unzip it (the path should not contain Chinese spaces, etc.)
The latest version is Tomcat 10. We can use Tomcat 8 because it is relatively stable. Before using Tomcat,必須要安裝好jdk,并配置好環境變量JAVA_HOME

-2, Startup & Shutdown

insert image description here
insert image description here

–3, Test

http://localhost:8080/

insert image description here

3. Tomcat directory structure

–1, core directory

D:\Java\apache-tomcat-8.5.72\bin: The directory where the executable files in the tomcat server are stored
D:\Java\apache-tomcat-8.5.72\conf: The directory where the configuration files in the tomcat server are stored
D:\Java\apache-tomcat-8.5.72\lib: stores the jar packages that the tomcat server depends on when running
D:\Java\apache-tomcat-8.5.72\logs: The directory where the log files generated by the Tomcat server are stored when it is running, recording some information about each startup and shutdown
D:\Java\apache-tomcat-8.5.72\temp: The directory for temporary files generated by the tomcat server. Tomcat will clean up this directory by itself, so you can ignore this directory.
D:\Java\apache-tomcat-8.5.72\work: stores the working files generated by the tomcat server
D:\Java\apache-tomcat-8.5.72\webapps: This is the default directory managed by the localhost virtual host. Your developed project code must be in the webapps directory before you can access your program through a browser, including various resources (html, css, js, jsp, servlet, pictures, etc.) and directories.
D:\Java\apache-tomcat-8.5.72\conf\server.xml: stores the core configuration of the tomcat server, including the host, port number, etc.
D:\Java\apache-tomcat-8.5.72\webapps\ROOT\WEB-INF\web.xml: You can configure the homepage of an application and other information

–2, change the default port number to 8080

Tomcat software uses port 8080 by default, but you can also customize the port number to what you need.

insert image description here
insert image description here

4. Access your own project resources

–1, add your own simple project in webapps

insert image description here
insert image description here

–2, Test

insert image description here

–3, a complete web application structure

You also need to create some file structures, which is not necessary if you use the development tool. The tool will automatically create these structures.

insert image description here

WEB-INF directory: Resource files placed in this directory are protected and cannot be directly accessed by the browser
classes directory, used to store compiled class files
lib directory, used to store jar packages that web applications depend on
web.xml file, used to store some configuration information related to the Web application (this file can be left unconfigured, but once created, it must be filled with content, otherwise an error will be reported)

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
  version="3.1">
  
</web-app>

5. Integrate Tomcat in IDEA

–1, the operation is as shown below

insert image description here
insert image description here
insert image description here

–2, Test

If there are resources in the server, you can test it directly. Rules: http://localhost:port number/project name/resource name Example: http://localhost:8080/test/studentform.html

This is the end of this article about the super detailed tutorial on getting started with Tomcat server. For more relevant Tomcat server content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed tutorial on installing Tomcat8.5 in Centos8.2 cloud server environment
  • Alibaba Cloud Server Tomcat cannot be accessed
  • Solution to slow response of Tomcat server
  • Detailed steps for configuring Tomcat server in IDEA 2020
  • Detailed steps for installing JDK and Tomcat on Linux cloud server (recommended)

<<:  Introduction to major browsers and their kernels

>>:  MySQL InnoDB transaction lock source code analysis

Recommend

Problems with index and FROM_UNIXTIME in mysql

Zero, Background I received a lot of alerts this ...

A brief analysis of React Native startReactApplication method

In this article, we sorted out the startup proces...

How to solve the abnormal error ERROR: 2002 in mysql

Recently, an error occurred while starting MySQL....

Let's learn about the MySQL storage engine

Table of contents Preface 1. MySQL main storage e...

Detailed explanation of flex and position compatibility mining notes

Today I had some free time to write a website for...

Download MySQL 5.7 and detailed installation diagram for MySql on Mac

1. Enter the following address in the browser htt...

Solution to the inaccessibility of Tencent Cloud Server Tomcat port

I recently configured a server using Tencent Clou...

mysql5.7.17 installation and configuration example on win2008R2 64-bit system

123WORDPRESS.COM has explained to you the install...

Windows Service 2016 Datacenter\Stand\Embedded Activation Method (2021)

Run cmd with administrator privileges slmgr /ipk ...

MySQL 8.0.21 free installation version configuration method graphic tutorial

Six steps to install MySQL (only the installation...