Tomcat9 + eclipse: how to publish a website, tomcat9eclipse

Source: Internet
Author: User

Tomcat9 + eclipse: how to publish a website, tomcat9eclipse

Prerequisites: you have installed eclipse on your computer and can perform normal javase exercises. The following code runs javaee for the first time to demonstrate how to use tomcat + eclipse to publish a website.

 

1. Download tomcat9 and decompress it. Decompress apache-tomcat-9.0.0.m10.zip and put it on drive C (which disk can be put), and rename the folder as tomcat9.

 

Figure 01

Open C: \ tomcat9 \ bin, Enter cmd in the Command box, press enter to start command window 02, enter startup and press enter to start tomcat. Enter localhost: 8080 in the browser, press enter to open the default page 04.

 

Figure 02

 

Figure 03

 

Figure 04

2. configure server in Eclipse:

Window -- Preferences -- Server -- Runtime Environment

Click Add, select tomcat v9.0, next, set the tomcat path, and click finish.

 

Figure 05

 

Figure 06

3. Create a web project:

File-New-Project-Web-Dynamic Web Project

Enter the project name, follow the configuration, and click Finish.

 

Figure 07

4. display the small Servers window:

Window -- show view -- other -- Server-Servers option -- OK. Show 10:

 

Figure 10

Click the link and click Next:

 

Figure 11

Select the new project and click Add. The project appears in the right area and Finish.

 

 

Figure 12

Servers is configured, as shown in.

 

Figure 13

In the small Servers window, we can see one line: Tomcat v9.0 Server at localhost [Stopped, synchronized], double-click to configure, 08, and close this page after Configuration:

 

Figure 08

5. Set an alias for a website:

Right-click the Project -- Properties -- Web Project Settings -- enter the alias "Emp" -- OK

 

Figure 14

6. configure a welcome page for web. xml:

Add the following nodes:

<! -- Configure the default welcome page for the website -->

<Welcome-file-list>

<! --

When the user sends the following request

Http: // localhost: 8080/Emp

Tomcat configuration information, automatically pushes emp_add.html to the user's browser

-->

<Welcome-file> page/emp_Add.html </welcome-file>

</Welcome-file-list>

 

The meaning of the above node is to set the default homepage address.

 

7. Create a new file folder pageunder webcontentand click "emp_add.html" on the web page.

 

Last visit URL:

Http: // localhost: 8080/Emp/

 

Summary: This article applies to the first person who configures the javaee environment. This article does not involve servlet development knowledge.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.