Author: husted Date: Mon Jan 2 08:13:03 2006 New Revision: 365371 URL: http://svn.apache.org/viewcvs?rev=365371&view=rev Log: How to Build an ActionForm * Add section on data transfer.
Modified: struts/action/trunk/xdocs/faqs/actionForm.xml Modified: struts/action/trunk/xdocs/faqs/actionForm.xml URL: http://svn.apache.org/viewcvs/struts/action/trunk/xdocs/faqs/actionForm.xml?rev=365371&r1=365370&r2=365371&view=diff ============================================================================== --- struts/action/trunk/xdocs/faqs/actionForm.xml (original) +++ struts/action/trunk/xdocs/faqs/actionForm.xml Mon Jan 2 08:13:03 2006 @@ -210,6 +210,51 @@ </li> </ul> + +</subsection> + +<subsection name="Transferring Data"> + + <p> + To transfer data between ActionForms and business objects, + many developers use the Commons BeanUtil methods. + To transfer data from an ActionForm to a business object, + you can use a statement like: + </p> + +<source><![CDATA[ + PropertyUtils.copyProperties(actionForm, businessObject); + +]]></source> + + <p> + To transfer data from a business object to an ActionForm, + you can reverse the parameters + + +<source><![CDATA[ + PropertyUtils.copyProperties(businessObject, actionForm); +]]></source> + </p> + + <p> + For more about using this technique, see the + <a href="http://jakarta.apache.org/commons/beanutils/"> + Jakarta Commons BeanUtils documentation</a>, + and the Struts MailReader example application. + </p> + + <p> + Aside from BeanUtils, + there are other tools available that make it easier to use business objects + and ActionForms together. + For more about POJO ActionForms, see the + <a href="https://formdef.dev.java.net/">FormDef</a> extension + and the <a href="https://strutslive.dev.java.net/">Struts Live</a> toolkit. + </p> +</subsection> + +<subsection name="Multipart Forms"> <p> Handling multipart forms is also easy. @@ -219,8 +264,6 @@ taglib to create the presentation page: </p> -<hr/> - <source><![CDATA[ <[EMAIL PROTECTED] language="java"> <[EMAIL PROTECTED] @@ -297,7 +340,7 @@ </subsection> - </section> + </section> </body> </document> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]