(was: Is there any direct link between model and view in struts..)

On 7/20/06, Michael Jouravlev <[EMAIL PROTECTED]> wrote:
Another library,
FormDef, can build a dynaform based on properties of nested business
object

Hey Michael,

Just thought I'd set the record straight.
FormDef does not require nor enforce nested beans.

public class Employee {
   public String getName() { return name; }
   public void setName(String name) { this.name = name; }

   public Date getHireDate() { return hireDate; }
   public void setHireDate(Date hireDate) { this.hireDate = hireDate; }

   public int getZipCode() { return zipCode; }
   public void setZipCode(int zipCode) { this.zipCode = zipCode; }
}

 ... plus ...

<form name="employeeForm" beanType="Employee"/>


 ... equals ...


<form-bean name="employeeForm" type="org.apache.struts.action.DynaActionForm">
   <form-property name="name" type="java.lang.String"/>
   <form-property name="hireDate" type="java.lang.String"/>
   <form-property name="zipCode" type="java.lang.String"/>
</form-bean>

You're still using traditional ActionForms, and you still need to copy
to and from the form bean and business object (using BeanUtils or
FormDef's own methods).

So, your form still looks the same way:

<html:text property="name"/>
<html:text property="hireDate"/>
<html:text property="zipCode"/>

FormDef support nested beans, and nested collections of beans.  If you
had a nested Address object, your form would look like:

<html:text property="name"/>
<html:text property="hireDate"/>
<html:text property="address.zipCode"/>


Hubert


[The first part of http://www.rabago.net/struts/formdef/nested.htm
explains the same thing, and goes on to explain how nested beans are
supported.]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to