InfoCenter Home >
4: Developing applications >
4.2: Building Web applications >
4.2.1: Developing servlets >
4.2.1.3: Servlet content, examples, and samples >
4.2.1.3.9: PageListServlet support >
4.2.1.3.9.3: Configuring page lists using an XML servlet configuration file

4.2.1.3.9.3: Configuring page lists using an XML servlet configuration file

An alternative or legacy way of providing PageListServlet configuration information, is using an XML file known as the XML Servlet Configuration file. This file provides configuration information for page lists, and additional servlet configuration information. The file has a .servlet extension and resides in the same directory as the servlet class file. The XML servlet configuration file must be created with one of the following names:

  1. servlet_class_name.servlet
  2. servlet_name.servlet

IBM WebSphere Studio provides wizards that generate servlets with accompanying XML servlet configuration files. If you are not using IBM WebSphere Studio, you can manually create XML servlet configuration files. Each XML configuration file must be a well-formed XML document. The files are not validated against a Document Type Definition (DTD). Although there is no DTD, it is recommended that all elements in the file appear in the same order as the elements described below:


XML Servlet configuration file elements
Elements Description
servlet The root element of an XML servlet configuration file.
code The class name of the servlet, that extends the PageListServlet, without the .class extension.
description The description of the servlet.
init-parameter The attributes of this element specify the name-value pair to be used as an initialization parameter on the servlet. A servlet can have multiple initialization parameters, each within its own init-parameter element.
markup-language Contains <ml-name>, <ml-mime>, and <page-list> elements. (The root element <servlet> can contain multiple <markup-language> elements.)
ml-name A markup-language type, as for example: HTML, or WML, or VXML, and so forth
ml-mime A MIME type, as for example: text.html, or text/x-vxml, or text/vnd.wap.wml, and so forth
page-list Contains <default-page>, <error-page>, and <page>+ elements. (A <page-list> element can contain multiple <page> elements.)
default-page Contains a <uri> element. The URI specifies the JSP to be called if the requested page does not exist or is not specified on the HTTP request.
error-page Contains a <uri> element. The URI specifies the JSP to be called when the handleError() PageListServlet method is called.
page Contains a <uri> and <page-name> element. The URI specifies the JSP file to be called when a PageListServlet method callPage() is called with the same value as <page-name>.
uri A JSP file within the WAR Module.
page-name The name in which a servlet, extending the PageListServlet, will use in the callPage() method to call a JSP.

Go to previous article: Configuring page lists using the Application Assemby Tool Go to next article: Example of the XML servlet configuration file

 

 
Go to previous article: Configuring page lists using the Application Assemby Tool Go to next article: Example of the XML servlet configuration file