You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

 action-servlet.xml (Integrating Spring With Struts)

The purpose of this configuration file is to integrate Spring with Struts by defining your Struts Actions in your Spring configuration.

It should contain a bean entry for every action in your app and these beans should be defined as singletons. The bean names in action-servlet.xml must match a corresponding action path in the action-mappings section of your struts-config.xml. So for instance, in the skeleton, the bean name="/EnterSearchCriteria" in the action-servlet exactly matches the action path="/EnterSearchCriteria" in the struts-config and they both refer to one of the three actions you will find in the skeleton (edu.mit.oasskeleton.controller.action.EnterSearchCriteriaAction).

Your app can have any number of entry points. Each of the entry points would have an action that can be configured in the action-servlet.xml to use the class edu.mit.mortar.controller.action.GlobalEntryAction. However, they must be named XXXEntryAction (where XXX is some name you choose), otherwise the session restart mechanism will cause your app to loop infinitely.

The example below is from the skeleton and comes with all new projects set up by the IDD Team. In this example there is a single entry point, /EntryAction, which is configured to chain to a specific action within the application in struts-config.xml. There are an additional 3 skeleton actions. In order to properly configure your application, you must change these 3 beans to reflect the actions in your application:

For example, the settings001s project action-servlet.xml has 2 actions:

There is normally a base action class that is injected with the service associated with your application. You can use mock services by overriding this baseAction.

For SAP apps, your base action should be the class edu.mit.mortar.controller.action.SAPBaseAction which is the default taken from the skeleton. So you don't need to make any changes to these lines.

  The Search Help actions found in mortar are also configured here. Again you don't need to make any changes.


  • No labels