Free tutorials for Java, Eclipse and Web programming



Follow me on twitter

Servlet and JSP development with Eclipse WTP

Lars Vogel

Version 1.3

16.05.2010

Revision History
Revision 0.1 - 0.212.12.2007Lars Vogel / Waldemar Geppart
First Version
Revision 0.3 - 0.6 10.09.2008 - 18.05.2009Lars Vogel
bugs fixed and improvements
Revision 0.702.07.2009Lars Vogel
Update to Eclipse 3.5
Revision 0.8 - 1.3 03.07.2009 - 16.05.2010Lars Vogel
bugs fixed and improvements

Eclipse Web Tool Platform (WTP)

This article describes the development of servlets and JSPs with Eclipse WTP.

This article is written with Eclipse 3.5 (Galileo) and Tomcat 6.0 and JDK 1.6.


Table of Contents

1. Eclipse Web Tool Platform
1.1. Overview of Eclipse WTP
1.2. Dynamic Web Project
2. Tomcat Installation
3. Installation of WTP
4. WTP Configuration
4.1. Server
5. Servlets
5.1. Project
5.2. Creating Data Access Object
5.3. Creating the Servlet
5.4. Run
6. JavaServer Pages (JSPs)
6.1. Create Project
6.2. Create the JSP
6.3. Run it
6.4. Adjust web.xml
7. JSP's and Servlets
7.1. Create Project
7.2. Create the Controller (servlet)
7.3. Create the Views (JSP)
7.4. Run it
8. Web Archive - How to create a war file from Eclipse
9. Additional Eclipse WTP resources
10. Thank you
11. Questions and Discussion
12. Links and Literature
12.1. Source Code
12.2. Web development resources
12.3. vogella Resources

1. Eclipse Web Tool Platform

Tip

If you are completely new to Java web development you may want to read this overview of web development with Java article: Introduction to Java Webdevelopment .

1.1. Overview of Eclipse WTP

Eclipse WTP provides tools for developing standard Java web applications and Java EE applications. Typical web artifacts in a Java environment are HTML pages, XML files, webservices, servlets and JSPs. Eclipse WTP simplifies the creation these web artifacts and provides runtime environments in which these artifacts can be deployed, started and debugged.

Eclipse WTP supports all mayor webcontainer, e.g. Jetty and Apache Tomcat as well as the mayor Java EE application server. This tutorial uses Apache Tomcat as a webcontainer.

1.2. Dynamic Web Project

In Eclipse WTP you create "Dynamic Web Projects". These projects provide the necessary functionality to run, debug and deploy a Java web application. Therefore for the development of Java web application you create "Dynamic Web Projects" .