RE: preparable vs modelDriven

2008-02-01 Thread Shannon, Andrew
t case provided there you need to check it out and start using it when writing these kinds of actions. I hope some of this makes sense. Thanks, Andrew -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Thursday, January 31, 2008 5:03 PM To: Struts Users Mailing List S

Re: preparable vs modelDriven

2008-01-31 Thread Jeromy Evans
I thought I'd quickly describe my usages and opinions of Preparable and ModelDriven in case it helps any one: - As Dave described, I also prefer to keep my prepare logic with the main code because it's easier for others to understand. - I do use Preparable in the cases where params-prepare-para

Re: preparable vs modelDriven

2008-01-31 Thread Musachy Barroso
Struts will by default populate parameters in your action, if you use ModelDriven, then you can supply the object that will be populated instead of the action. Implementing preparable will make struts call prepare() before the action is executed, or prepareX() before X() is executed. They are just

Re: preparable vs modelDriven

2008-01-31 Thread Adam Hardy
I don't think you are strictly conveying the intended usage, when you say that the getModel() method will 'later' return the model. It depends how your interceptor stack is ordered. In the docs, it explicitly says the ModelDrivenInterceptor should come before ParametersInterceptor, as often the

Re: preparable vs modelDriven

2008-01-31 Thread Roberto Nunnari
Dave Newton wrote: --- Roberto Nunnari <[EMAIL PROTECTED]> wrote: The prepare() method task is to retrive the model and store it as an instance variable. The getModel() method will later return the model when asked by the framework that will put it on the value stack. Please correct me if I'm

Re: preparable vs modelDriven

2008-01-31 Thread Dave Newton
--- Roberto Nunnari <[EMAIL PROTECTED]> wrote: > The prepare() method task is to retrive the model > and store it as an instance variable. > > The getModel() method will later return the model > when asked by the framework that will put it on the > value stack. > > Please correct me if I'm wrong.

Re: preparable vs modelDriven

2008-01-31 Thread Musachy Barroso
you are right. On Jan 31, 2008 1:12 PM, Roberto Nunnari <[EMAIL PROTECTED]> wrote: > The prepare() method task is to retrive the model > and store it as an instance variable. > > The getModel() method will later return the model > when asked by the framework that will put it on the > value stack.

Re: preparable vs modelDriven

2008-01-31 Thread Roberto Nunnari
The prepare() method task is to retrive the model and store it as an instance variable. The getModel() method will later return the model when asked by the framework that will put it on the value stack. Please correct me if I'm wrong. Best regards. -- Robi Adam Hardy wrote: Dave Newton on

Re: preparable vs modelDriven

2008-01-31 Thread Adam Hardy
Dave Newton on 31/01/08 16:00, wrote: Adam Hardy <[EMAIL PROTECTED]> wrote: Dave Newton on 31/01/08 15:29, wrote: Adam Hardy <[EMAIL PROTECTED]> wrote: * ModelDriven: how do I get hold of my model during my action methods? I don't want to get getModel() again, because that will retrieve anoth

Re: preparable vs modelDriven

2008-01-31 Thread Dave Newton
Adam Hardy <[EMAIL PROTECTED]> wrote: > Dave Newton on 31/01/08 15:29, wrote: >> Adam Hardy <[EMAIL PROTECTED]> wrote: >>> * ModelDriven: how do I get hold of my model during my action methods? I >>> don't want to get getModel() again, because that will retrieve another >>> instance of the entity

Re: preparable vs modelDriven

2008-01-31 Thread Adam Hardy
Dave Newton on 31/01/08 15:29, wrote: --- Adam Hardy <[EMAIL PROTECTED]> wrote: * ModelDriven: how do I get hold of my model during my action methods? I don't want to get getModel() again, because that will retrieve another instance of the entity and not the one that was populated by struts.

Re: preparable vs modelDriven

2008-01-31 Thread Dave Newton
--- Adam Hardy <[EMAIL PROTECTED]> wrote: > Is my understanding correct that Preparable and ModelDriven are 2 different > ways of doing the same thing, or are they complementary in any way? They *could* be used to do the same thing, but IMO Preparable is more general-purpose than ModelDriven, and