To: Struts Users Mailing List
Subject: Re: preparable vs modelDriven
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
Is my understanding correct that Preparable and ModelDriven are 2 different ways
of doing the same thing, or are they complementary in any way?
After reading up on the website there are a few questions that spring to mind.
* ModelDriven: how do I get hold of my model during my action methods?
--- 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
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.
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 another
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 and not the
--- 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.
Some
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.
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
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
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
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
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
13 matches
Mail list logo