How to configure Tomcat in the Eclipse environment
- Open Eclipse, click on the "Window" menu and select "Preferences" below.
- Click the "Server" option and select "Runtime Environments" below.
- Click "Add" to add Tomcat.
- Click "Next" to select the Tomcat path you have installed.
- Click "Finish" to finish.
Build a Web Application
- File→New→Dynamic Web Project
- Create aDynamic Web Project
- Click "Next" Next
- Click "Next" Next
- Click "Finish" to complete
Have the Tomcat server appear on the console and deploy the Web app to Tomcat
-
- Window→Show View→Servers
-
- Click on the linkNo servers are available. Click ths link to create a new server.to select the Tomcat version in the popup dialog box.
-
- Click "Next" to add our project
Select the item and click Add, or double-click to add to the right
-
Click "Finish" to complete
Return to the Servers panel below, right-click the Tomcat v8.0 Server at localhost node in the Panel, and click Start on the popup shortcut menu to launch the specified Web server. If you start the access directly at this pointhttp://localhost:8080/TomcatTest, you will find that 404 error is reported. This is because we did not add the main page, below add the content of homepage (index.jsp):
<% @ page language = "java" contentType = "text / html; charset = utf-8" pageEncoding = "utf-8"%>
<! DOCTYPE html PUBLIC "-// W3C // DTD HTML 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv = "Content-Type" content = "text / html; charset = ISO-8859-1">
<title> Welcome page </ title>
</ head>
<body>
Welcome to use eclipse to deploy Tomcat.
</ body>
</ html>
Note: Web resources must be added under the Webroot directory.
At this point, once again to access the link:http://localhost:8080/TomcatTest, the effect is as follows:
How to configure the Tomcat server in the eclipse:eclipse for Java EE Environment and have the Tomcat server appear on the console to deploy the Web app to Tomcat