Configuring servlet properties

See the Java Servlet Specification Version 2.4 for information about various servlet properties. All EAServer 6.0 servlet properties are maintained in either the Web application’s web.xml file (for J2EE servlets) or the config file (for non-J2EE servlets). To modify any of these properties, make changes to the corresponding file and redeploy the Web application to which the servlet belongs. See “Deploying Web applications”.

Servlets are contained in the Web Components folder under the Web application.

Init-param settings

Servlets may require initialization parameters that are specified outside of the source code. For example, you might specify the name of an EAServer data source as an initialization parameter. You can use the Init-param property to define optional initialization parameters for the server.

For each parameter, enter the parameter name and the text of the value. The servlet can retrieve the value as a Java String, as explained below.

Your servlet’s init method can retrieve the specified settings using the ServletConfig.getInitParameter(String) and ServletConfig.getInitParameterNames() methods. The following code fragment shows how:

void init(ServletConfig config) throws ServletException {
  ....
  Enumeration paramNames =     config.getInitParameterNames();
  while (paramNames.hasMoreElements())
  {
    String name = (String) paramNames.nextElement();
    String value = config.getInitParameter(name);
  }