Splitting the application into modules

Now, we'll divide our login sample application into two modules. The first module - called outside - will provide the part of the application, where the user is not logged in. The second module - called inside - will provide the part, where the user is logged in. To achieve this, we need to

  1. split our controller configuration into the two files calyxo-control-config-outside.xml and calyxo-control-config-inside.xml.
  2. Adjust the deployment descriptor, web.xml, to contain the required servlet declarations and mappings for our modules.
  3. Optionally, rearrange resource locations to reflect the new module structure. Also, we may want to avoid i18n resource bundles to be shared by different modules.

Before we show you how to do this, let us consider an important issue on modules.

Switching modules

Though an application should be partitioned into modules with minimizing dependencies in mind, there's obviously a need to change the current module. Basically, Calyxo supports two ways to do that:

  • In a dispatch element of a module's controller configuration, specify both, the module and action attributes, to dispatch to an action in another module.
  • In a JSP page, jump to another module via a HTML link. Again, specify the module and action attributes in Calyxo's <calyxo-base:a> tag.

This is a nice thing, because your module does not have to know anything about how modules are mapped to url patterns. All you have to know is the target module's name and the action path. Calyxo will do the rest for you.