0.9.2: What are page lists?

Some servlets (or JSP files) process data related to a user request, then forward the user request to one of several Web pages, based on the outcome of processing the data. For each outcome, the "page list" part of the servlet configuration specifies the location to which to forward the request.

As a simple example, consider a logon servlet that:

  1. Prompts for and reads a user ID and password
  2. Submits these for authentication by a user registry or directory service
  3. Waits to find out whether the directory service approves or denies the user
  4. Based on the outcome, forwards the user either to the page that is the entry point to the requested resource, or to a "logon denied" page

A page list allows developers to avoid hard coding the locations (URIs or URLs) of servlets and JSP files. In the above example, the developer would not need to hard code URLs specifying the two possible pages to which the user could be directed.

By avoiding hard coding, a developer does not need to recompile a servlet in order to change the URLs to which the servlet refers users.

Instead, the administrator tending the servlet can simply change the page list in a servlet configuration file, which is separate from the servlet class file and is named servlet_instance_name.servlet. The list can contain a default page, error page, and other JavaServer Pages that are called, depending on the HTTP request. Whenever the .servlet file changes, the application server automatically reloads the corresponding servlet instance.

Servlets do not automatically have configuration files -- implementing a page list requires some effort. With WebSphere Application Server, you can either manually create a servlet configuration file (.servlet file), or use one generated by IBM WebSphere Studio. In addition, the servlet developer must ensure that the servlet supports page list functionality.