Possible Duplicate:
Can I propagate struts2 ActionErrors between different action classes?
in action.Test1
public class Test1 extends ActionSupport {
public String execute() {
addActionMessage("Hello in test2");
return SUCCESS;
} else {
addActionError("Please try again");
return INPUT;
}
}
in struts.xml
<action name="test1" class="action.Test1">
<result name="success" type="redirect">test2</result>
</action>
<action name="test2" class="action.Test2">
<result name="success">/test2.jsp</result>
</action>
I want to display ActionMessage
and ActionError
in test2.jsp
For redirect
it means a new request, which will make the framework drop all data related to the first request and new object of request and response will be placed in the values stack and hence in your case your ActionMessage
and ActionError
data lost.
If you are doing it in same App context it's more advisable to use redirectAction
if it's going to the other action as redirect
result is used to redirect to another URL (web resource).
In order to save the data you have these options