I stripped out all the stuff that needed initialization from my action, and
I can see the message works on the redirect. So the fix it OK :-)
###
When I say the default, I mean myStack
<default-interceptor-ref name="myStack" /> otherwise
the action I call does not work due to not having gone through any kind of
stack, no parameters etc or my ActionPrepareInterceptor not being called.
>From the code below, if only store is used, it calls the interceptor and
then invokeActionOnly(); on the class ie execute.
if (interceptors.hasNext()) {
final InterceptorMapping interceptor = interceptors.next();
String interceptorMsg = "interceptor: " +
interceptor.getName();
UtilTimerStack.push(interceptorMsg);
try {
resultCode =
interceptor.getInterceptor().intercept(DefaultActionInvocation.this);
} finally {
UtilTimerStack.pop(interceptorMsg);
}
} else {
resultCode = invokeActionOnly();
}
On 7 March 2016 at 07:47, Lukasz Lenart <[email protected]> wrote:
> 2016-03-06 15:36 GMT+01:00 Greg Huber <[email protected]>:
> > I think we are OK on this, as I can see from the example that the default
> > stack is included. So it would work like this.
> >
> > Initially I did not include the default which is why it was not working.
> > Although the docs are a bit vague on how the store should be used,
> > including the default is required.
> >
> > <action name="HelloWorld1"
> > class="org.apache.struts.example.HelloWorld1">
> > <interceptor-ref name="default"/>
> > <interceptor-ref name="store">
> > <param name="operationMode">AUTOMATIC</param>
> > </interceptor-ref>
> >
> > <result type="redirectAction">HelloWorld2</result>
> >
> > </action>
>
> Basically you just need to define "store" interceptor (with assumption
> that the session was already created elsewhere), you don't need to
> reference any other stack, there is no such requirement. In most cases
> you don't need all the interceptors defined in a stack, just two or
> three to handle what is needed for action. And in the same way "store"
> interceptor works. In "STORE" mode more things is required ie.
> Validation, Workflow, to perform validation and store messages in the
> session, that's why there is a reference to the "defaultStack" in the
> example. In "RETRIEVE" mode only session is needed (but it was already
> created in "STORE" step) and nothing else to fetch messages from the
> session and put them in scope, that's why only "store" interceptor is
> referenced in the "RETRIEVE" step.
>
>
> Regards
> --
> Ćukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>