Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress Servlet Development Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

3.7 Adding the Servlet to the web.xml file

Each servlet must appear in a web.xml file within a context directory. To add a servlet to an existing context, add a servlet and servlet-mapping element to the context. The sample below shows a complete web.xml file for the HelloWorldExample servlet:

The deployment descriptor above creates an instance of the HelloWorldExample servlet and names that instance HelloWorld. Because the servlet is located in the examples context, the url-pattern element maps the servlet to /examples/HelloWorldExample/. That is, the container forwards all requests that begin with /examples/HelloWorldExample/ to the HelloWorld instance. This servlet configuration is identical to the configuration for HelloWorldExample in the web.xml file for the examples context.

Chapter 4 explains the context web.xml file and describes how to deploy and configure servlets, filters, and listeners.

Previous fileTop of DocumentContentsIndex pageNext file

©2004-2007 Copyright Quovadx, Inc. All Rights Reserved.
Quovadx and Rogue Wave are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.