Eclipse configuration Tomcat detailed tutorial, including how to use eclipse+tomcat to create and run web projects

1: Tomcat download official website: Apache Tomcat® - Welcome! https://tomcat.apache.org/

Enter the official website to display the interface as shown in the figure. The downloaded version below is Tomcat 9.0. You can choose one yourself .

Click and enter the following interface:

My computer is 64-bit, so the 64-bit version I download depends on the situation. The workmanship of this article is relatively rough, so don’t pay attention to these details, hahaha~ After downloading, unzip it to your disk, preferably in your Create a folder on the D drive and unzip it in it. You can name the folder yourself, as long as you know what is inside. The unzipped file below looks like this:

Remember the decompression path will be used later! ! !  The next step is how to get it into Eclipse~~

Two: eclipse joins tomcat

First, open eclipse, then click on the window, and then click on the last preference. Mine is in Chinese, and yours may be in English. Anyway, just follow it.

 Find sever and double-click Runtime Environment.

Then click Add to add tomcat

Select the Tomcat version you downloaded

Click Next, and then select the path where you decompressed Tomcat as shown:

 

Select the folder, and then the path to tomcat is selected as shown:

Then click Done. Next click Windows ==》Click show view ==> Other and find the servers in the Sever file

  

Then double-click and the following interface appears:

Then select the second one for Use, and create a new folder on the D drive for Deploy path, such as webapp.

 Then x out and choose save. Next, verify whether tomcat is configured successfully.

Three: Verify whether tomcat is configured successfully

Right click the mouse and click start

 When the following interface appears

 Enter the browser and search for local host: 8080 (default address). If the following interface appears:

So congratulations, you succeeded! ! !

Four: Let’s start our first Javaweb

First create a web project (FIle==》New==》Dynamic Web Project)

Then create a project name as shown in the figure, select our server as Target runtime, mine is Apache Tomcat v 9.0, and then click Next.

When you click Next to reach the interface shown below, we put a "tick" in Generate to generate the xml file, and then click Finish, as shown in the picture:

 At this time, the web project we just created will appear in our project resource management, as shown in the figure:

 Then we right-click the webapp (mine is jsp, everyone creates it differently, just click Create, it will not affect) to create a jsp file, as shown in the picture:

 Next fill in the file name and click Finish:

 After completion, we will see an interface like this. We enter Hello world! between <body> and </body>.

 Then, we right-click hello world.jsp to run our project

Then this interface will appear. We select the tomcat server and click Next, as shown in the figure:

This interface will appear after taking you to the next step. If the project we created is in the first box, we need to add it to the second box and click Finish.

 The results of successful operation are as follows:

 Or we can also view the running results in the browser (browser input: localhost:8080/directory where the file is located/file name), and then Enter. The running results are as follows:

 

That’s it for now. I hope this is helpful to you. It would be best if you could give me a like, haha~   Finally, I wish you a happy study! ! !

Guess you like

Origin blog.csdn.net/m0_65996411/article/details/126551818