You can still use the Global Result, just set the global results value to an
OGNL expression.  This limits the places you can use the interceptor to
actions that can fill the OGNL expression, but you could handle that with a
common base class if you really want to go down this path.  I don't think
you really want to just call another Action (which is totally doable, but it
won't have any of it's data since it's interceptor stack won't have been
run).  Basically what you want is a method on your common base class like:

method getNextAction () {
  return "next";
}

And a global result like:

<result name="gtfo" type="redirect-action">${nextAction}</result>

I think you would be better off sticking to the tried and true patterns that
the Struts team has designed the system to work with, but if you must, this
should work.
  (*Chris*)

On Wed, May 27, 2009 at 2:17 AM, Stefano Corallo <stefan...@gmail.com>wrote:

> Hi Criss,
> thanks for your reply.
>
> I know the global result, but is unusefull for this purpose. The problem is
> that the actions that i want to call is knew at runtime cause the
> interceptor at init time scan classes with certain annotations and i want
> to
> forward to those actions so i can't put the result in struts.xml because i
> can't know what action to call.
>
> So my question is: the only way for an action to redirect to another action
> is via redirect-action-result ? like described in:
> http://struts.apache.org/2.x/docs/redirect-action-result.html
> Maybe putting in the annotation the information to call the action i want
> ....
>
> --
> Stefano Corallo
>
>
> On Wed, May 27, 2009 at 9:07 AM, Chris Pratt <thechrispr...@gmail.com
> >wrote:
>
> > Sort of.  The way that I've achieved something similar to what you seem
> to
> > be asking is to define a bunch of Global Results in struts.xml that
> define
> > common actions that the interceptors may need to invoke (like
> > reset-password
> > or invalid-input), then instead of chaining to the action in the
> > interceptor, just return the name of the global result and you've
> > effectively called that action.
> >  (*Chris*)
> >
> > On Tue, May 26, 2009 at 11:53 PM, Stefano Corallo <stefan...@gmail.com
> > >wrote:
> >
> > > Hi all,
> > >
> > > can an interceptor call an arbitraty action different from the action
> > > requested by the client?
> > >
> > > Suppose i've the interceptor "interceptor-router" placed in the stack
> and
> > > the client call MyAction.action, when the interceptor intercept the
> call
> > is
> > > possible to 'redirect' the call to MyDifferentAction.action from the
> > > interceptor?
> > >
> > > I've seen that there is action chaining but this require to know at
> build
> > > time the name of the actions i want to redirect to, but i know the name
> > > only
> > > at runtime and
> > >
> > >
> > > I hope i was clear :) sorry for my english.
> > >
> > >
> > > --
> > > Stefano Corallo
> > >
> >
>

Reply via email to