I am hoping that someone can clear up what has become a foggy picture in my
mind regarding the transfer of data between an ActionForm bean and
corresponding entity beans.

Ted Husted wrote:

"Using a nested bean on your ActionForm lets you use the form like a
wrapper, so you don't have to define everything twice, if your business
beans and ActionForm beans would otherwise be identical"

I take this to mean that if my ActionForm bean and entity bean are identical
then I can supply getters and setters on the ActionForm bean for the entity
bean and use the nested bean format in my jsp.  In this way my ActionForm
will be populated correctly from the entity bean and changes made in the jsp
will be reflected in the entity bean.

A second scenario occurs when properties on the ActionForm do not match
those on the entity bean.  In this situation I am a little unclear what to
do.  One suggestion I read was to create a toMap() method on the ActionForm
bean and then use this with the BeanUtils.populate() method to populate your
entity bean.  My question here does the data transformation take place in
the toMap() method, or does BeanUtils.populate() do the transformation for
you?  Also, this takes care of moving data from the ActionForm bean to the
entity bean, but how about doing the opposite (populating the ActionForm
bean from the entity bean), does the entity bean also need to expose a
toMap() method that can then be used with BeanUtils.populate() to populate
the ActionForm bean?

A couple final questions:

1)I have seen a lot written about value object beans.  From what I gather
these seem to be light weight proxies for entity beans.  Is this correct? If
so what is the advantage to using them over entity beans?  How are they
typically instantiated, is there a method provided by the entity bean?  How
does data get from a value object bean to its corresponding entity bean?

2)I have seen several references to PropertyUtils class.  Does this class
enter in any way to solutions to my questions above?

Thanks for your help.

Regards,

Dave


Reply via email to