|
|  |

Servlet configuration follows the Servlet 2.2 deployment descriptors.
Servlets generally belong in the WEB-INF/classes directory of
the web application.
The mapping from url to servlet is controlled by servlet mapping in the application configuration.
For a complete, working example, see Servlet
or experiment with the Hello, World demo.
Defines a servlet alias for later mapping.
| Attribute | Description
|
| servlet-name | The servlet's name (alias)
|
| servlet-class | The servlet's class (defaults to servlet-name)
|
| init-param | Initialization parameters
|
| load-on-startup | Initializes the servlet when the server starts.
|
| run-at | Times to execute the servlet automatically
|
The following example defines a servlet alias 'hello'
<web-app id='/'>
<servlet-mapping url-pattern='/hello.html'
servlet-name='hello'/>
<servlet servlet-name='hello'
servlet-class='test.HelloWorld'>
<init-param title='Hello, World'/>
</servlet>
<servlet servlet-name='cron'
servlet-class='test.DailyChores'>
<run-at>3:00</run-at>
</servlet>
</web-app>
|
Alias of the servlet
Class of the servlet The CLASSPATH for servlets includes
the WEB-INF/classes directory and all jars in the WEB-INF/lib directory.
Initializes servlet variables. servlet-param
defines initial values for getServletConfig().getInitParameter("foo").
The full servlet 2.2 syntax is supported and allows a simple shortcut
<web-app id='/'>
<servlet servlet-name='test.HelloWorld'>
<init-param foo='bar'/>
<init-param>
<param-name>baz</param-name>
<param-value>value</param-value>
</init-param>
</servlet>
</web-app>
|
If present, starts the servlet when the server starts.
<web-app id='/'>
<servlet servlet-name='hello'
servlet-class='test.HelloWorld'>
<load-on-startup/>
</servlet>
</web-app>
|
run-at
If present, calls the servlet's service() method
at the specified times.
<run-at> lets servlet writers execute periodic tasks without worrying
about creating a new Thread.
The value is a list of 24-hour times when the
servlet should be automatically executed. To run the servlet every 6
hours, you could use
<servlet servlet-name='test.HelloWorld'>
<run-at>0:00, 6:00, 12:00, 18:00</run-at>
</servlet>
|
If the hour is omitted, the servlet runs every hour at the
specified minute. To run the server every 15 minutes, you could use:
<servlet servlet-name='test.HelloWorld'>
<run-at>:00, :15, :30, :45</run-at>
</servlet>
|
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc. |  |
|