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.

  • Attributes within the XML tag, action
    • Each path (e.g., /SearchPeople) must exactly match a bean name within action-servlet.xml.
    • Because our 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).
    • 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). 
    • 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 input attribute. If 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 but for most other screens the user should stay on the page and correct their input. So input is required in most non-initial action paths.
    • Usually scope should be "request" unless there is a need to maintain user entered values between pages (e.g., /SearchHelpNavAction or actions associated with pages utilizing search help), in which case scope can be "session" but remember to reset the form variables for new entry requests (see mortar's reset method within ActionForm SearchHelpParamsForm).
    • Attributes within the XML tag, forward, within the tag, action
      • name (e.g., "SearchResultsPage") must exactly match the value sent to ActionMapping's findForward method in the action, which in this example is SearchPeopleAction (e.g., last line of this class is return mapping.findForward("SearchResultsPage")).
      • path (e.g., "oasskeleton.search_results") must exactly match a definition name in the tiles-def.xml file.

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