Tags in action mapping XML file

Action mapping XML file is used to describe the relationship between template files and action classes. It also describes the relationship between filters and action classes. Each Web application can have many action mapping files rather than only one mapping file (default.action.xml). You can define these mapping files in "default.action.xml" file by using "include" tag. KEVIX will read all tags in "default.action.xml" and also read other action mapping file(s) which is/are defined in "default.action.xml".
Here is an example of "default.actions.xml" file:

default.actions.xml
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<!-- define all default views' paths -->

   <default-views>
      <view name="login">login.html</view>
      <view name="error">failure.html</view>
   </default-views>

<!-- include other XML mapping file(s) -->

   <include file="mappinFiles/forum.actions.xml" />
   <include file="mappinFiles/project.actions.xml" />

<!-- define all action classes -->

   <action actionPath="common/RedirectAction.php" name="Redirect" className="RedirectAction">
      <view name="success">test.html</view>
   </action>

   <action actionPath="TestAction.php" name="Test" className="TestAction">
<!-- define related filter(s) -->
      <rel-filter name="Application"/>
      <rel-filter name="Validation" method="submit"/>
<!-- define view(s) -->

      <view name="success">showResult.html</view>
      <view name="form">form.html</view>
   </action>
</actions>
  1. default-views tag:
    • It is optional tag.


    • In this tag, it can have one or more "view" tag(s) to define default value(s) of "return" string(s) in all action classes. In this example, it defines "login" and "error" in "default-views" tag. That means these "return" strings' values will set to all actions ("Redirect", "Test") and all actions which are defined in other included files (mappinFiles/admin.actions.xml).


    • Make sure that "default-views" tag is placed before "include" tags and "action" tags.


    • "default-views" tag must only be defined in "default.action.xml" maping file. Other mapping files cannot use this tag.

  2. include tag:
    • It is optional tag.


    • The "file" attribute defines the location of action mapping file.


    • The "include" tag must only be defined in "default.action.xml" maping file. Other mapping files cannot use this tag.

  3. action tag:
    • The "actionPath" attribute defines the location of action class file.


    • The "name" attribute defines the keyword for calling this action class.


    • The "className" attribute indicates what class is used in action class file.


    • In "action" tag, it can have one or more "view" tag(s) to define value(s) of "return" string(s) in that action class.


    • In the "view" tag, "name" attribute defines the name of "return" string and the content between "view" tags is the location of template file.


    • In "action" tag, it can also have one or more "rel-filter" tag(s) to define what filter(s) will be used in action class. The "method" attribute of "rel-filter" tag defines which method of action class use that filter. If this attribute does not define, that means all methods will use this filter.
      *Note: The order of defining "rel-filter" tags is also the order of running filters.