NonStop Servlets for JavaServer Pages (NSJSP) 5.0 System Administrator's Guide

Configuring NSJSP
NonStop Servlets for JavaServer Pages (NSJSP) System Administrator’s Guide525644-003
3-11
web.xml
Preloading Servlets
A set of servlets can be automatically loaded on startup time by using the <load-on-
startup> element in the web.xml file, as shown in Example 3-7.
The <load-on-startup> element indicates that this servlet should be loaded on the
startup of the web application. The content of this element must be a positive integer
indicating the order in which the servlets should be loaded. Lower integers are loaded
before higher integers. If no value is specified, or if the value specified is not a positive
integer, the container loads the element any time in the startup sequence.
Example 3-7 shows a servlet class file, SessionSnoop, which has a priority of 3. Files
that have a higher priority are loaded before this one. Note that the servlet class name
is SessionSnoop, but a URL could reference the servlet by the servlet name Snoop.
Defining a Session Timeout Value
A session timeout parameter could be in either of the two versions of the web.xml file.
You can define a default session timeout interval value for all sessions created in the
web application by using the <session-config> and <session-timeout>
elements in the web.xml file. The specified timeout value must be expressed in
minutes, as shown in Example 3-8.
Example 3-7. Preloading Servlets
<servlet>
<servlet-name>Snoop</servlet-name>
<servlet-class>SessionSnoop</servlet-class>
<load-on-startup>3<load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Snoop</servlet-name>
<url-pattern>/Snoop</url-pattern>
</servlet-mapping>
<servlet-mapping>
</servlet-name>Snoop</servlet-name>
<url-pattern>/servlet/Snoop</url-pattern>
</servlet-mapping>
Example 3-8. Defining a Session Timeout Value
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>