struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: How to clear DynaActionForm?
Date Wed, 09 Nov 2005 02:07:31 GMT
The default implementation of reset() doesn't actually reset any 
properties. If you need it to do so, you'll have to subclass 
DynaValidatorForm and override the reset() method.

Althernatively, you can clear a dyna form by clearing the Map object it 
contains: form.getMap().clear().

HTH,

L.

pc leung wrote:
> even the following cannot clear fields in
> <form-bean name="userProfileForm"
> type="org.apache.struts.validator.DynaValidatorForm" >
>             <form-property name="engName" type="java.lang.String" />
>             <form-property name="chiName" type="java.lang.String" />
> 
> 
> DynaActionForm userProfileForm = (DynaActionForm)form;
> ...
> userProfileForm.set("chiName", "");
> userProfileForm.set("engName", "");			
> return mapping.findForward("success");	
> 
> How can the form's fields be cleared after input successfully?
> 
> Thanks
> 
> 
> On 11/7/05, pc leung <pingcheungl@gmail.com> wrote:
> 
>>struts-config.xml:
>><form-bean name="userProfileForm"
>>type="org.apache.struts.validator.DynaValidatorForm" >
>>
>>
>>DispatchAction class:
>>DynaActionForm userProfileForm = (DynaActionForm)form;
>>...
>>userProfileForm.reset(mapping, request);
>>return mapping.findForward("success");
>>
>>The reset function does not clear form.
>>How it be cleared?
>>
>>Thanks
>>


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


Mime
View raw message