struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <>
Subject Re: reset method with DyanValidatorForm
Date Wed, 01 Nov 2006 15:35:44 GMT
On 1/6/06, Wendy Smoak <> wrote:
> On 1/6/06, fea jabi <> wrote:
> > So, I might have to reset the checkboxes now.
> >
> > Do, I have no other choice but to create a formbean Class with all the
> > setter's and getter's and then add reset method too for it.
> >
> > or is there an easier way to do this using DynaValidatorForm?
> You don't have to add the get/set methods.  Just extend
> DynaValidatorForm and add the reset method -- then be sure to change
> the type of the form in struts-config.xml to your new form type.
> package com.example.myapp;
> public final class AccountForm extends DynaValidatorActionForm
> implements Serializable {...}
>        <form-bean
>             name="accountForm"
>             type="com.example.myapp.AccountForm">

Hubert added a new feature in Struts 1.3.x that allows you to
configure "reset" behaviour on a property-by-property basis in the
struts-config.xml - I believe you just  add reset="true" attributes to
your <form-property> elements and it will reset the values to whatever
is (or isn't) specified by the "initial" attribute. Something like the


    <form-bean  name="fooForm" type="org.apache.struts.action.DynaActionForm">
        <form-property name="state"  type="java.lang.String"
initial="INITIAL" reset="true"/>
        <form-property name="unsubscribe" type="java.lang.String"
initial="true" reset="true"/>



> --
> Wendy

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message