struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <>
Subject Re: usage of Preparable interface?
Date Thu, 01 May 2008 13:55:00 GMT
Dave Newton wrote:
> --- Jeromy Evans <> wrote:
>> I've been toying with the idea of creating a custom interceptor to do 
>> this.  It would be effectively the same as you describe, except that it 
>> would inspect the action for the presence of some interface, annotation, 
>> or method, and examine the request for some characteristic (eg. get 
>> method) and if matched it creates/looks up the model and injects it into 
>> an appropriate scope (eg. into the action, into the action context, 
>> request scope, or onto the valuestack). 
>> That way you could remove all the boilerplate from your actions.
>> eg, If it placed the model into the actioncontext you could potentially use
>> <s:select name="state" list="#states"/>
>> without your action providing the list or getter at all (except 
>> something must instruct the interceptor to load it). 
> Annotated, parameterized with an injectable load implementation?
> The load impl takes a context, from which it could use whatever information
> needed to create/load the object, or be stubbed during development and
> testing.
> Dave

Yeah. A load impl injected via the DI framework is probably too early, 
but one injected via an S2 interceptor could be configured to execute 
after the params interceptor.  hmm...

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message