How to Create Web Application in Eclipse using Tomcat

In this Blog you will learn how to create and build a web application in eclipse using tomcat.

 

Step 1:

Download and install tomcat from here http://tomcat.apache.org/

 

Step 2:
Download and install Eclipse IDE for Java EE Developers.

Link: https://www.eclipse.org/downloads/packages/release/kepler/sr2/eclipse-ide-java-ee-developers

 

Step 3:

Start and Open Eclipse.

 

Step 4:

Window -> Preferences -> Web -> CSS+HTML+JSP -> Encoding: ISO
10646/Unicode(UTF-8).

 

Step 5:

Window -> Open Perspective -> Other -> Java EE.

 

Step 6:

File -> New -> Dynamic Web Project.

 

Step 7:

Enter the Project name.

 

Step 8:

Target Runtime -> [New%u2026] -> Apache -> Apache Tomcat vX.X -> Next -> Tomcat installation directory -> [Browse%u2026] -> <Path to tomcat>\Tomcat X.X -> Finish.

 

Step 9:

Then click Finish.

 

Step 10:

Right click on WebContent -> New -> JSP (index.html / index.jsp as startfile) -> Next -> Use JSP template -> New JSP File(xhtml) -> Finish.

 

Step 11:

Right click on project -> Run As -> Run on Server -> Finish.

 

Step 12:

Project is available under http://localhost:8080/projectname

 

Step 13:

To change the context root/URI in eclipse : Right click on project -> Properties -> Web Project Settings -> “New Context root” -> Apply -> OK -> OK.

 

Step 14:

Right click project -> Export -> WAR file -> Destination: -> [Browse%u2026] -> <Path to tomcat>\Tomcat X.X\webapps (write name in small letters) -> Save -> Finish.

 

Step 15:

To change the context root/URI for tomcat just rename the WAR file.

 

Step 16:

Stop Eclipse-tomcat-server by pressing STRG+ALT+S.

 

Step 17:

Start tomcat (“<Path to tomcat>\Tomcat X.X\bin\tomcatXw.exe”).

 

Step 18:

Now Project is deployed in tomcat and can be used without eclipse.

 

So Guys 🙂 In this way you can create and build a simple web application in eclipse using tomcat. Hope you like this article. If you still need more help and assistance, please comment down below so that we can help you. Good Luck!!