ECLIPSE and TOMCAT (web applications)

Apache Tomcat & Eclipse Platform make a great Web development platform. Tutorials about this development environment are available on the following websites:

I use the Tomcat version 5.5.23 as localhost because this version is available on my hosted website provided by my ISP Visual Online. My Eclipse version is Galileo (3.5.2). The Java SDK is 1.6.

Web applications are deployed on the Tomcat server with a WAR file (which stands for “web application archive” ) A WAR file is a ZIP file used to distribute a collection of JavaServer Pages, servlets, Java classes, XML files, tag libraries and static Web pages that together constitute the Web application.

There are special files and directories within a WAR file.

  • The /WEB-INF/classes directory contains the .class files (servlets, …)
  • The /WEB-INF/lib directory contains the .jar files with the Java librairies
  • The /WEB-INF directory contains a file named web.xml which defines the structure of the web application

The main elements of the web.xml file are shown below :

<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app id=”WebApp_ID” version=”2.4″ xmlns=”” xmlns:xsi=”” xsi:schemaLocation=””>

<description>Describe What the application is doing and add comments</description>


<description>Une application très simple</description>






The elements of a web.xml file are :

  • the name of the application : <display name>
  • the name, class and parameters of the servlet : <servlet>
  • the mapping of the servlet : <servlet-mapping>
  • context parameters : <context-param>
  • session parameters : <session-config>
  • list of index files : <welcome-file-list>
  • MIME mapping : <mime-mapping>
  • other parameters referring to security, errors, filters, …

The other files (html, jsp, iamges, …) are stored in the root or in folders located in the root of the WAR file. They can’t be included in the WEB-INF directory.