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

Compare with Current View Page History

« Previous Version 39 Next »

struts-config.xml (The Struts Configuration File)

 form-beans

Each of your ActionForms must be configured within the form-beans section of the struts-config.xml. In the example below the oas-skeleton has 3 ActionForms.

 action-mapping

Each of your Actions must be configured within the action-mappings section of the struts-config.xml.

    • Each action path (e.g., /SearchPeople) must exactly match a bean name within action-servlet.xml.
    • Because our action types  indicate the Spring DelegatingActionProxy, it is the bean name within the action-servlet.xml (e.g., /SearchPeople) that maps the bean name to the actual Action (e.g., SearchPeopleAction).
    • action name - For each Action that accepts input from the user, there should be an ActionForm (e.g., SearchCriteriaForm) attached to its associated action path (e.g., /SearchPeople). 
    • action input - If the input is going to be validated either via the SAP RFC or the Struts Validator Framework, a jsp/tile (e.g., oasskeleton.enter_search_criteria) to go back to in case of errors should be specified via the action input attribute. If action input is not specified, any error messages returned from the SAP RFC will cause a MessageRuntimeException and the user will be sent to the fail page. This is often appropriate on initial screens when there is nothing the user can do to correct the problem.
    • action scope should be "request" unless there is a need to maintain user entered values between pages (e.g., "search help" which takes user off page and back again), in which case scope can be "session" but remember to reset the form variables on new entry requests (see ActionForm). 
  • forward 

The struts-config.xml is also where /EntryAction is configured to chain to one of your Actions (e.g., the Action associated with the bean name /EnterSearchCriteria). Your app can have multple entry points. Each of these should be like the /EntryAction example below and their action-servlet bean name/ struts-config bean path must be in the format XXXEntryAction (where XXX is some name you choose), otherwise the session restart mechanism will cause your app to loop infinitely.

For actions that don't need input (hidden or visible), they should not have a form.

  • No labels