struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles" <>
Subject Re: DynaActionForm in session scope
Date Sat, 14 Dec 2002 02:59:48 GMT
Hi Tibor,
Good examples and explanations. I have a clearer picture of how it works
now. Thanks!

----- Original Message -----
From: "Gemes Tibor" <>
To: "Struts Users Mailing List" <>
Sent: Friday, December 13, 2002 12:15 AM
Subject: Re: DynaActionForm in session scope

2002. december 13. 20:00 dátummal Charles ezt írtad:
> Thanks for your help. But I'm still a little confused. How do you extend a
> DynaActionForm? I thought it was created on the fly.

Only the properties are created on the fly, the class itself is

So here is the rough overview of what I have done.

public class CondResetDynaActionForm extends DynaActionForm {
    /** Reset the property to its initial value conditionally.
    public void reset(ActionMapping mapping, HttpServletRequest request) {
        String name = mapping.getName();
        if (name == null) {
        FormBeanConfig config =
        if (config == null) {
        FormPropertyConfig props[] = config.findFormPropertyConfigs();
        for (int i = 0; i < props.length; i++) {
            // reset only if not CondResetFPC or getReset() returns true
    if (!(props[i] instanceof CondResetFormPropertyConfig) ||
                set(props[i].getName(), props[i].initial());

Extend the FormPropertyConfig with a reset property. (homework :)

> Also you mentioned about using the set-property tags. Please forgive my
> ignorance, but could you provide me with a working example of how this
> set-property tags can be used to present the reset() being called?

If you want to leave the reset() as it was originally, you declare your
form-bean as DynaActionForm. If you want your own reset to be executed,
declare it as CondResetDynaActionForm.
The set-property could be used to determine per form-property whether you
to reset it or not. But in this case you have to specify, that this is your
FPC class, not the original one as the original FPC does not have "reset"
<form-bean name="myForm"
<form-property name="myProp1" type="java.lang.String"
<set-property name="reset" value="false" />



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

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

View raw message