Basically, all that you need to do here is separate out the various actions into
different config files. In my case I needed three config files: struts-config.xml
for the default module (home page, About Me, etc.), struts-config-articles.xml
for the articles module, and struts-config-software.xml for the software
module. Once you separate the files, make sure that each action in your app appears
in the correct module config file.
Assuming that you are using Tiles, each struts-config-xxx.xml should
contain a TilesPlugin definition. For now point them all to the same
tiles-defs.xml file since we'll want to verify that your Struts modularization
works before moving onto the Tiles modularization.
The first thing to note is that for each module, you will need a corresponding folder in your web directory, and the folder names must be the same as the module names. There may be ways to change the names, but if so, I'm not aware of them. Anyway, the resources corresponding to a given module (such as the JSPs) go in the module folders.
In general, you will need to modify links and images to point to modularized versions of the same. This is somewhere it's nice to use the Struts HTML taglib. Let's look at links first. Continuing with the example of the present web site, I had to change the links
<html:link page="/home.do">Home</html:link>
and
<html:link page="/articles/index.do">Articles</html:link>
to
<html:link module="" action="/home.do">Home</html:link>
and
<html:link module="/articles" action="/index.do">Articles</html:link>
The module attribute is optional unless you need to link to a module
that's different than the linking module. When linking to a separate module, use
the empty string for the default module, and use /moduleName for other
modules, as shown above. If you specify a module explicitly, use the action
attribute; otherwise, use the page attribute.
Images are similar to links. Use the module, action,
and page attributes in exactly the same way you do with links.
Incidentally, if you have a big site, you will have lots of links and images to update. This might be an argument for using modules from the start, even if you begin with only a single default module.
In addition to links and images, check your CSS, JavaScript, Flash, etc. references. Some of these are probably broken.
Not too much to worry about here; just make sure that you include your new Struts
config files in your WEB-INF directory so that the ActionServlet
can find them. Don't forget tiles-defs.xml and your TLDs.
At this point you should deploy your web app and try things out. The main thing to check is that the links, images, CSS, etc. all resolve correctly. If your app has more than a few pages, there are bound to be broken links. The main problems will probably be things like not having placed slashes in your modules/pages/actions, not including the module attribute for links that take the user from one module to another, etc. If you get stuck on something, see the HTML Taglib API Reference for more information.
Once you are satisfied that your app is working correctly, it's time to modularize
the tiles-defs.xml file.