--- "Fernandes, Filipe" <[EMAIL PROTECTED]> wrote:
> I used wildcard mapping to define several methods that may be 
> called for a struts action class. But each of those methods 
> contain duplicate lines of code that need to be called before 
> the method returns.
>  
> Is there a way in struts to wire up a post operation after the action
> method (whichever it happens to be) gets called?

You basically want the opposite of prepare, but running before the
result is rendered.

AFAIK there's nothing like that built in to S2, and I'm not as opposed
to your solution as some people might be. By explicitly putting the
call in the method it's crystal-clear what's happening, where, why, and
how.

One solution I used, sort of a horrible interceptor/AOP hybrid, was to
define an interface that accepted a Spring-configured list of pre- and
post-processing to run during action method execution... It was less
complicated than Spring AOP (and didn't sound as scary) and was
application-specific (in that the pre-/post-processing methods had some
idea what types of things they'd be expected to do).

Not sure if I'd do it like that again, although it suited my purposes
at the time. Just an idea, and I'll be interested in what other people
have to say. With Spring's AOP available I'm not as sure I like the
more "custom" mechanism I used, but it *was* easier for us at the time.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to