hi,

thanks for your reply but this didn't seem like solve my problem entirely as
PreparableInterceptor gets called before  ParameterInterceptor. The upshot
is that i didn't have an access to my parameters which drive prepare method.
Nevertheless i found that probably the easiest solution here is to
use paramsPrepareParamsStack interceptor. Surely i call some of the
interceptor twice but at least i've an access to the parameters.



On Tue, Jun 29, 2010 at 12:56 PM, Rene Gielen <rgie...@apache.org> wrote:

> Hi Greg,
>
> the thing about ModelDriven is that the model object gets pushed on the
> value stack _before_ your action method is executed. To initialize the
> model object before the ModelDrivenInterceptor comes into play, just
> implement Preparable and do your initialization in prepare() (as Lukasz
> already suggested)
>
> - René
>
> Greg Stasica schrieb:
> > hi,
> >
> > the scenario is as follow:1
> > 1. class EditMyBeanAction implements Model...
> > 2. url mapping calls edit method on the EditMyBeanAction
> > 3. the result should be that once edit method returns (it loads MyBean
> > object from the database) MyBean should be displayed on the jsp
> >
> > the problem is that it seems like with hibernate it doesn't work at least
> > when used as below (reassigned object addresses)
> >
> > classs EditMyBeanAction  implements Model ..<MyBean>
> >
> > private MyBean bean = new MyBean();
> >
> > public MyBean getModel()
> > {
> > return bean;
> > }
> >
> > public String edit()
> > {
> >  MyBean mb = hibernateFacade.loadMyBeanObjectById(123);
> > // bean.setName("test")    ----- 2
> > bean = mb;    // 3
> > return "success";
> >
> > }
> >
> >
> > i suspect that the problem is somewhere around proxy classes either in
> > hibernate or ognl (i would rather start to look here though) because if i
> > uncomment line 2 and comment out 3 i'm getting the test value on the name
> > property.
> >
> > surely the workaround is to:
> > 1. copy properties from one object to another but again this is simply a
> > waste of memory :)
> > 2. get the MyBean object in getModel() method but i don't think this
> method
> > should do any dao/business operations
> >
>
> --
> René Gielen
> http://twitter.com/rgielen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Greg Stasica

Reply via email to