struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roberto Nunnari <roberto.nunn...@supsi.ch>
Subject Re: preparable vs modelDriven
Date Thu, 31 Jan 2008 18:12:37 GMT
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 31/01/08 16:00, wrote:
>> Adam Hardy <ahardy.struts@cyberspaceroad.com> wrote:
>>> Dave Newton on 31/01/08 15:29, wrote:
>>>> Adam Hardy <ahardy.struts@cyberspaceroad.com> 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.
>>>> Lazy initialization (via null check or by setting an instance var), or
>>>> config through Spring, or...
>>> If your getModel() puts the model entity on an instance variable, won't
>>> that confuse the param interceptor? 
>>
>> Depends on what instance variable you put it in, I suppose. One of your
>> questions was how to access the model object w/o running through a 
>> getModel()
>> method that would re-instantiate; lazily initializing an instance 
>> variable in
>> getModel() then using that instance variable is one way of dealing 
>> with that.
> 
> OK, that makes sense now, thanks. What I thought would be the more 
> obvious way of obtaining the model would be to fetch it from where 
> struts puts it when it calls getModel(), i.e. the value stack, however I 
> don't see any access methods for doing that, particulary on ActionSupport.
> 
> 
> Adam
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message