Activating the module
We're almost done with the controller part of our sample application. Now, let's make our module known to the servlet container. This is done in the web application's deployment descriptor, which has to be made available as /WEB-INF/web.xml.
To specify our login-sample module, we have to do the following:
- define a servlet for our module
- pass it the configuration file as an initialization parameter
- map an url pattern to the servlet
Here's our web.xml:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4">
<!-- Module Servlet -->
<servlet>
<servlet-name>login-sample</servlet-name>
<servlet-class>de.odysseus.calyxo.control.ModuleServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/calyxo-control-config.xml</param-value>
</init-param>
<load-on-startup/>
</servlet>
<!-- Module Mapping -->
<servlet-mapping>
<servlet-name>login-sample</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- Welcome File -->
<welcome-file-list>
<welcome-file>index.jspx</welcome-file>
</welcome-file-list>
</web-app>
The url mapping we chose to address our module is a so called extension mapping: all context relative paths ending with .do select our module. Alternatively, we could have used a prefix mapping like /main/*: all context relative paths starting with /main/ select our module.
That's it!


