MyEclipse and Tomcat configuration detailed tutorial analysis

First, the basic concept of Servlet:

Servlet is a dynamic web resource development technology provided by Sun. In essence, it is a small java program. You can add a servlet to the servlet container to run.

Servlet container: The environment in which the servlet can run is called the Servlet container. — tomcat

Web container: The environment that can run web applications is called a web container - tomcat

The basic operation of Servlet:

Write a picture description here

Servlet does not have a main() method. They are controlled by another Java application (such as Tomcat), this Java application is called a Sevlet container, and Tomcat is such a container. Usually we call Tomcat a servlet container.

Servlets are executed by default in multi-threaded mode.

Note: JSP is for the convenience of writing html code and Java code, it is actually a Servlet.

Second, the configuration of MyElipse:

1. Select the workspace: As long as the workspace is switched, all configurations are cleared.

2, configure jdk:

Select the menu bar Windows–”Preferences, select the tab Java–”Installed JREs, the interface is as follows:

Write a picture description here

In the above picture, you can see that MyEclise has its own jdk, then we still use the jdk installed by ourselves, click the “add” button in the above figure, the following interface pops up:

Dcaa9a3e-234d-4554-a095-cd79aa510142

In the figure above, select the jdk path you installed, then finish, continue:

4b049373-8846-4b46-849a-04c4eee31bb5

3, configure the coding of the workspace: from now on, the default encoding of the text files in any project you create is utf-8

Select the menu bar Windows–preferences and select the tab General–”Workspace as follows:

9f2560cc-f09a-4fd2-9ba6-b8d849133898

4, change the font:

Write a picture description here

Third, use MyEclipse to create a Web project:

1, MyEclipse specifies Tomcat:

Select the menu bar Window–”Preferences, select the tab MyEclipse–”Servers–”Tomcat, then:

E2a59d5a-d7ed-476d-be98-832866ae67c1

In the above picture, select your own Tomcat directory, remember to check the "Enable" in the red box.

Check the running jdk:

14fc3ca3-f8fd-40f4-a727-6869062f1f47

At the same time, we close MyEclipse to bring Tomcat:

9dcdf99f-737b-48d5-b723-9f6c4aede9e9

0aeddb4b-8c59-4acf-bec7-e0750b54bb53

2, MyEclipse create a Web project:

868ac036-277f-40dd-a761-98c80d132da4

The Context root URL in the above figure refers to the virtual path of external access. Click finish to continue:

713edfd5-3791-439c-be36-fc998aa4fd13

In the above picture, select "no". If you choose "yes", it will compile with 6.0 instead of 5.0. carry on:

0bfb900a-1f72-475c-b322-237a29bf5702

In the image above, let you switch from the Java view to the MyEclipse view and select "yes".

The newly created project has the following directory structure:

E830f48f-8b80-4737-97cf-212756afc087

WebTest: The name of the web project. When the project is deployed, there will be an example web application in the webapps directory.

Src directory: The development directory of the Java program. All programs written in this directory are automatically deployed to the example/web-inf/classes directory when deployed.

WebRoot directory: webroot corresponds to the root directory of the web application. All subdirectories and subfiles in the directory will be published to the web application directory when deployed.

If you need to modify the Context Root of the Web project's external access path, you can right-click on the project, select ProperTIes, and select MyEclipse–Web Label:

3c5db6f7-f0a0-4f05-8412-4bfb28e92722

In the red box of the above picture, you need to change it.

3. MyEclipse publishes the web project to Tomcat:

Select the button in the above picture (below the menu bar), the prompt text is: Deploy Project to Server, the following interface pops up:

9eb9a10f-ea21-4d5d-8e4c-1d4bf2b59a12

In the figure above, select add and continue:

B34edee6-3d3c-4ebe-9523-189e159b3ec3

In the picture above, choose Tomcat before us, just fine.

Of course, there is another way to publish to Tomcat by right-clicking on the project file with the following effects:

206884db-e6b1-4c31-a63a-6a4e4db28211

Once the project is released to Tomcat, it will immediately copy the project's WebRoot directory to Tomcat's webapps directory and rename the WebRoot to the project name, WebTest:

F34238b0-aa61-42c8-bf7d-271d71757b8d

After publishing, if you want to see the effect on the webpage, you need to run Tomcat first:

50fc161f-f670-4f1e-860b-5e6d19b0d984

Then enter the url at the URL:

258797e1-a0a8-4609-9c5c-efbc24d9e332

Fourth, the general steps to create a Servlet:

The framework of the Servlet consists of:

The Servlet framework consists of two Java packages: Javax.servlet and Javax.servlet.http. The Javax.servlet.Servlet interface in the core of the Servlet framework, all Servlets must implement this interface.

step:

Fume Infinity Vape

Fume Infinity Disposable Vape pen provides 3500 hits. Infinity is Fume`s longest lasting e-cigarette device compare to fume ultra and fume extra! Fume infinity feels like last forever before the e-juice or battery runs out! The nic salt is 5%, we can customize is to 2% or 0% according to customer require. Have a try and fume infinity will suprise you!

Fume Infinity Vape,Fume Infinity Disposable,Fume Infinity 3500,Fume Infinity 3500 Puffs

Shenzhen Kate Technology Co., Ltd. , https://www.katevape.com

Posted on