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의 기본 output 폴더인 build 를 WEB-INF/classes 로 바꾸기 위해 Build Path  를 선택한다.
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 탭을 클릭한다. 아래 Default output Folder 옆의 Browser 를 클릭한 다음 Create New Folder 를 클릭하여 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" />