Um, by nested beans I mean a bean which is a property of ActionForm
like Employee, not a bean which is a property of a bean which is a
property of an ActionForm, like Address. I guess there is a
discrepancy in terminology here ;-)

What I mean is this (taken from
http://www.rabago.net/struts/formdef/manual.htm):

"To declare a form bean using FormDef, simple add a <form> entry in
the configuration file, provide the name for your form bean, and the
name of the class from which the form bean will be patterned after.
... When the plugin gets executed, it will create a DynaActionForm
containing String fields for each property of MyBean.

To me MyBean is nested within a DynaActionForm. If this is not a
proper term, what do you call it? Calling it just a property will do a
disservice (I think so) because it is not a primitive type.

So when converters and validators are executed? Is it correct that
when I call  FormUtils.setFormValues() then output converter is
executed (uh, do you have output converters?), and when I call
FormUtils.getFormValues() then input converters and validators are
executed? Validation or conversion is not executed automatically or at
least can be turned off?

On 7/20/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
(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