Dynamic Web Project

You must first install the Eclipse IDE for Java EE Developers and Tomcat on your system.
See Eclipse Instll and Tomcat Install.

Start Eclipse.(suppose the workspace is C:/www)
In the Java EE perspective, select File, New, Dynamic Web Project as shown below.
1. New - Dynamic Web Project
Click Next button.
2. Dynamic Web Proejct
In the 'Project name:' text box, type JSPProject.
I will not run Tomcat in Eclipse, so leave all the values except the project name as default and click 'Finish'.
3. Dynamic WebProject - JSPProject
In the Package Explorer view, select the JSPProject project with the mouse and click the right mouse button and select Build Path, Configure Build Path ... as shown below.
5. Dynamic WebProject's output folder, build - WEB-INF/classes
Click the Source tab.
source tab
Click the Browse... button of the Default output folder.
Click the Create New Folder... button to create the WEB-INF/classes folder.
Set the WEB-INF/classes folder to be the Default output folder. Build Path - source tab - Default output Folder's Browser click - Create New Folder click - WEB-INF/classes
Make sure the Default output folder is JSPProject/WebContent/WEB-INF/classes. Build Path, JSPProject/WebContent/WEB-INF/classes

Loading JSPProject into Tomcat

Create the ROOT.xml file as shown below and save it to CATALINA_HOME/conf/Catalina/localhost and then restart Tomcat.
(Where CATALINA_HOME is the directory where Tomcat is installed)

ROOT.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context
	docBase="C:/www/JSPProject/WebContent"
	reloadable="true">
</Context>

If the ROOT.xml file are correct, Tomcat loads the ROOT application.
Note that the docBase value in ROOT.xml is not C:/www/JSPProject.
The parent directory of WEB-INF is the Document Base.

WEB-INF/web.xml

web.xml is the configuration file for the web application.
If you created a Dynamic Web Project in Eclipse, web.xml can be created automatically.
If not, copy the web.xml file of the ROOT application in CATALINA_HOME/webapps and paste it into the WEB-INF directory of JSPProject.
Then, open the web.xml and delete all within the web-app element as follows.

web.xml
<?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"
  metadata-complete="true">

</web-app>

Test

Create a test.html file on the Document Base.
With the WebContent selected as shown below, right-click and select New, then HTML File.
웹 애플리케이션이 톰캣에 등록한 후에 테스트하기 위해서 웹 애플리케이션의 루트 디렉토리에 test.html 이라는 파일을 만드는 화면이다.
Visit http://localhost:8080/test.html.
Where port is the port number used by Tomcat, you can find the port number in the CATALINA_HOME/conf/server.xml file.

<Connector port="8080" protocol="HTTP/1.1" 
	connectionTimeout="20000" 
	URIEncoding="UTF-8"
	redirectPort="8443" />