RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


A Quick Guide to Installing Tomcat on Windows  : Page 5

Get started using Java Server Pages (JSP) by installing the Open Source Jakarta Tomcat Servlet and JSP container.


Step 4: Deploy Your Application
Each Web application must have its own ServletContext. The ServletContext acts as a link between your application and the Tomcat engine. You create a ServletContext by adding a line in the conf/server.xml file. It looks like this:

   <Context path="/foo" docBase="foo" debug="0" 
      reloadable="true" />
The path attribute tells Tomcat that all request URLs ending in /foo belong to the foo application. The docBase attribute tells Tomcat that the foo application resides in a subdirectory of the webapps folder called foo.

You can now copy all the JSP, HTML, and image files associated with your application. You place JSP and HTML files in the application directory. Next, create a web.xml file in the WEB-INF folder (you can copy and modify one of the existing web.xml files to get started). Copy your Servlets to the /foo/WEB-INF/classes directory and add an entry to the web.xml file for each Servlet associated with the application. The Servlet entry provides Tomcat with information about the Servlet, its class file, and any parameters that may need to be passed to the Servlet. If your application consists only of JSP pages, then you don't need to worry about modifying the web.xml file.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date