Hi there,
If you want to do a one-time run some code during startup of a Struts application, the recommended way to do it (in Struts 1.1) is to develop a plugin. You do this as follows:
1. Create a class that implements the org.apache.struts.action.PlugIn interface.
2. Create an init () method in the new class that contains your startup code. See the PlugIn API for the specifics on what needs to be done here.
3. Register the plug-in at the bottom of the struts-config.xml file. See the struts-config.xml DTD on how to do this.
And that should be it.
If, on the other handle, you want to modify and extend the behaviour of Struts' RequestProcessor (for example, if you want to modify Struts' handling of action-based security), then
you should do the following:
1. Create a class that implements org.apache.struts.action.RequestProcessor.
2. Override the appropriate method whose behaviour you want to modify. For instance, if you want to modify Struts' handling of action-based security, override the 'processRoles' method. See the RequestProcessor API for a complete list of methods.
3. Register your RequestProcessor in the struts-config.xml file using the '<controller />' tag. See the struts-config.xml DTD for more information on how to do this.
BTW, the Struts Tiles plugin implements its own RequestProcessor, so if you want to use your RequestProcessor alongside the Tiles' RequestProcessor, make sure your processor extends TilesRequestProcessor instead of implementing RequestProcessor. If you don't Tiles will crap out during start-up.
Cheers,
Darryl