Use store interceptor
and set its operationMode
parameter on AUTOMATIC
as follows:
<action name="actionName" class="..." method="...">
<interceptor-ref name="store">
<param name="operationMode">AUTOMATIC</param>
</interceptor-ref>
<interceptor-ref name="defaultStack" />
<result ..../>
</action>
It will automatically set your messages in appropriate scope. For redirectAction
result it will be session scope but after displaying your messages this interceptor will automatically remove them.
EDIT (Annotation syntax):
interceptorRefs={
@InterceptorRef(value="store", params={"operationMode", "AUTOMATIC"}),
@InterceptorRef(value="defaultStack", params={"params.acceptParamNames", "catId, catName, currentPage, rowCount, totalPages, status", "validation.validateAnnotatedMethodOnly", "true"})
})