struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Jouravlev <jmi...@gmail.com>
Subject Re: [FORMDEF] Combining FormDef and Struts form definitions
Date Wed, 02 Nov 2005 19:22:27 GMT
On 11/2/05, Hubert Rabago <hrabago@gmail.com> wrote:
> On 11/2/05, Michael Jouravlev <jmikus@gmail.com> wrote:
> > Hubert,
> >
> > I cannot find if you explained it already, how to combine FormDef and
> > a regular Struts dynaform definitions. In your manual you write only
> > about DynaValidatorForm.
>
> FormDef can only work with forms defined by FormDef.

That's a pity. See below.

> > Considering your recent patch to DynaActionForm, I would like to
> > define a form with resettable properties, and to use FormDef to link
> > it to business object. How do I do that?
>
> You can specify the form type:
>
>     <form-definition>
>         <formset>
>             <form name="myForm"
>                 beanType="com.my.dto.MyBean"
>                 formType="com.my.web.MyCustomDynaForm"/>
>         </formset>
>     </form-definition>
>
> http://www.rabago.net/struts/formdef/manual.htm#formtype

Um, that is not exactly what I asked about. I want to define
resettable properties in struts-config.xml file (or somewhere else, I
don't care where), for example:

<form-bean name="LogonForm"
type="org.apache.struts.validator.DynaValidatorForm">
  <form-property name="username" type="java.lang.String"/>
  <form-property name="password" type="java.lang.String" initial=""
reset="true"/>
</form-bean>

And then to use defined LogonForm bean in FormDef to bind it to
business class or DTO, kind of like in your example:

<form-definition>
  <formset>
    <form name="LogonForm" beanType="com.my.dto.UserInfoBean"/>
  </formset>
</form-definition>

Here "name" attribute refers to the form bean that already defined in
struts-config.xml. Or you create another attribute, whatever.

If this is not feasible, would be great if you added support for
resettable properties directly to FormDef. I was just thinking that
combining and reusing is better than redefining.

Michael.

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


Mime
View raw message