Struts2 action Tag (data tag)
Usage:
This tag allow us to invoke another action from our view layey. It allow us to include the content of the seconds actions view in the first parent actions view layer using the 'executeResult' attribute. It allow us to use the values set by the second action in the frist action after the execution of the second action.
Using this tag the you can handle the secondary action can receive, or not receive, the request parameters from the primary request, according to the 'ignoreContextParams' attribute.
Attributes:
name:
It is required and it is the action name.
namespace:
It is not mandatory. Its type is String. It specified the action namespace; defaults to the cur-rent page namespace
var:
It is not mandatory. Its type is String. It specifies the reference name of the action bean for use later in the page.
executeResult:
It is not mandatory. Its type is Boolean. When it is set to true, It executes the result of the action (default value: false).
ignoreContextParams:
The secondary action can receive, or not receive, the request parameters from the first request action, according to the value of this attribute.
flush:
Is is not mandatory. When this attribute set to true, the writer will be flushed upon end of action component tag (default value: true)
Example:
Before second action tag.<br>
<s:action name="secondAction"/>
After second action tag<br>
Request attribute set by second action = <pre> <s:property value="#request.attrSetBySecondAction"/>