You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dan Allen <da...@mojavelinux.com> on 2003/04/05 10:07:41 UTC

nested dynaforms possible?

In several books, the nested tag library is introduced with struts
action forms using the following example:

Assume you have a personal information form which includes a person
object and a nested address object.  The form would contain a single
object, the Person object and that person object would contain
several properties, one which is the Address object.  The example
shows how you would create an ActionForm to deal with this.  My
question is, how would you do it with a DynaValidatorForm?

Pseudo-configuration would be like

<form-bean name="pimForm" type="org.apache.struts.validator.DynaValidatorForm">
    <form-property name="person" type="org.example.model.Person"/>
</form-bean>

but then you loose all chance to do validation.  Is this just
something for the future or is this possible now.  It seems to me
that you can either have nested forms or you can use validation but
not both.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Since no one can ever know for certain whether or not his own 
view of creation is the correct one, it is impossible for him 
to know if someone else's is the wrong one.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: nested dynaforms possible?

Posted by Dan Allen <da...@mojavelinux.com>.
Dan Allen (dan@mojavelinux.com) wrote:

> In several books, the nested tag library is introduced with struts
> action forms using the following example:
> 
> Assume you have a personal information form which includes a person
> object and a nested address object.  The form would contain a single
> object, the Person object and that person object would contain
> several properties, one which is the Address object.  The example
> shows how you would create an ActionForm to deal with this.  My
> question is, how would you do it with a DynaValidatorForm?
> 
> Pseudo-configuration would be like
> 
> <form-bean name="pimForm" type="org.apache.struts.validator.DynaValidatorForm">
>     <form-property name="person" type="org.example.model.Person"/>
> </form-bean>
> 
> but then you loose all chance to do validation.  Is this just
> something for the future or is this possible now.  It seems to me
> that you can either have nested forms or you can use validation but
> not both.
> 
> Dan

Of course!  How easy!  In the form-bean definition in the
struts-config.xml file you only have to put the top level objects,
specifying the class for each one.  Then, in the validation.xml you
treat each nested properties using the "dot" notation so that you
can concentrate on each field individually.  Sweet!  Struts rocks!

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
[Frodo]: "He deserves death." 
[Gandalf]: "Deserves it! I daresay he does. Many that live 
deserve death. And some that die deserve life.  Can you give 
it to them?  Then do not be too eager to deal out death in 
judgement. For even the very wise cannot see all ends."
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org