Hello all.

In my app, I use the DynaActionForm, because it makes it much easier to
declare all the forms I need.  However, it is giving me a problem with
Boolean type variables used in checkboxes.

Specifically, I have the following form-bean:

<form-bean
        name="test_form"
        type="org.apache.struts.action.DynaActionForm">
    <form-property
        name="Download"
        type="java.lang.Boolean"
        initial="true"/>
</form-bean>

In my JSP, I have:

<html:checkbox property="Download"/>

This is properly checked by default.

The problem is that when a user unchecks the checkbox, this is not
noticed in the form, due to the infamous
HTTP-doesn't-send-empty-parameters problem.  The canonical advice I have
seen is 'set the property to false in the form's reset() method'.

This has two problems:
a) DynaActionForm's reset does nothing by default.  Is there really no
support for this common thing in DynaActionForm?
b) I created a subclass on DynaActionForm, which had a reset() method
that only sets that property to false.  However, the ActionForm.reset()
method is apparently called via the <html:form> tag, (the doStartTag()
method calls initFormBean(), which calls the form bean's reset()
method).  This means that the checkbox is initially unchecked, and seems
to be a problem regardless of using DynaActionForm or not.

So, my question is: how can I have a Boolean checkbox that defaults to
true, and yet can tell when it is unchecked, and still use
DynaActionForm?

Thanks,
katre


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to