You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by char <ch...@yahoo.com.cn> on 2004/08/10 07:44:25 UTC

clone of ActionForm to DomainObject

hi all:

    I get this problem for some week, It is very troubler.

    Now I use xdoclet to generate the ActionForm form the DomainObject.

    I want to implement some method convert it.

(1) Method 1 : only one ActionForm to changed to DomainForm 
   eg:
<code>
 class  SimpleActionForm () extends ActionForm
{
    public getName ()
    {...}
    public setName ()
    {...}
}
class Simple ()
{
    public getName ()
    {...}
    public setName ()
    {...}
}
</code>
This is easy to use "BeanUtils.copyProperties(target, o);"to do it
------------------------------------------------------------
(2) Method 2 : one-to-anotherone or one-to-many or one-to-anotherone-many ..... ?
   how to deal with this kind of ActionForm to changed?
  eg:
<code>
 class  OneActionForm () extends ActionForm
{
    public getName ()
    {...}
    public setName ()
    {...}
    public getAnotherActionForm ()
    {...}
    public setAnotherActionForm ()
    {...}

}
class AnotherActionForm() extends ActionForm
{
    public getName ()
    {...}
    public setName ()
    {...}
}

</code>
<code>
 class  One ()
{
    public getName ()
    {...}
    public setName ()
    {...}
    public getAnother ()
    {...}
    public setAnother ()
    {...}

}
class Another()
{
    public getName ()
    {...}
    public setName ()
    {...}
}
</code>



   I think I can regiest a Convertor to ConvertUtils, 
   to dynamic changed the ActionForm Object to DomainObject.
   do it?

--------------------------------------------------------------------------
    how to do it? pls give some advice or some opensouce to solve,
    thanks.


Regards,
charlse