struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kothari, Kailash" <Kailash_Koth...@intuit.com>
Subject RE: Inheritance within form beans
Date Wed, 03 Oct 2007 20:40:11 GMT
Thanks a lot Rick. That gives me a new area to explore.

The BeanUtils method - BeanUtils.copyProperties(Object target, Object
src) - does give me a shallow copy of an object, Im trying to figure out
how to get a deep copy..

Thanks !
Kailash. 

-----Original Message-----
From: Rick Reumann [mailto:rick.reumann@gmail.com] 
Sent: Wednesday, October 03, 2007 7:21 AM
To: Struts Users Mailing List
Subject: Re: Inheritance within form beans

On 10/2/07, Kothari, Kailash <Kailash_Kothari@intuit.com> wrote:
> Thaks Rick.
>
> This will give me an instance of the parent bean OR the child bean.
>
> What I need is a child bean pre populated with data from the parent 
> bean.

Ok, so just get ParentBean and then populate your subclassed bean...


public SomActionMethod()  {

         BaseFormBean beanFromSession =
(BaseFormBean)session.getAttribute(mappingName);

         CurrentFormSubClass myForm = (CurrentFormSubClass)form;

       BeanUtils.porpulate( myForm, beanFromSession );

     //done, now your myForm is populated with the one from the session
}

---------------------------------------------------------------------
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