>>>>> "David" == David M Karr <[EMAIL PROTECTED]> writes:

    David> I've often been frustrated by some details of the "radio" and "checkbox" 
tags.
    David> I have some issues with the rules for producing the "name" of the resulting
    David> element, and for deciding whether the component should be checked.  I'd 
like to
    David> get some opinions on my proposed change.

    David> The crux of the problem is that the "property" attribute is "overloaded" for
    David> two purposes:

    David>  1. The name of the bean property to get the current value from.
    David>  2. The name attribute of the HTML component.

    David> Unfortunately, it's often desirable (IMHO) for those two values to be
    David> different.

    David> For instance, it seems conceivable that the bean used to populate the 
component
    David> would have two fields, one being a String, representing the "option name", 
and
    David> the other being a boolean, indicating whether the option is on or not.  It
    David> would be reasonable to name the boolean field "enabled".

    David> However, using a boolean property of "enabled" means that the resulting 
radio
    David> button will have a "name" attribute of "enabled", as opposed to something 
akin
    David> to the "option name".

    David> I've modified my local copy of the Struts (1.0.1rc1) so that the "radio" tag
    David> has two additional attributes:

    David>   "nameValue"

    David> If present, this will be the value of the "name" attribute in the resulting
    David> component.  If not set, the value of the "property" attribute will be used.

    David>   "checkedProperty"

Note that in my changes, I didn't change the "property" attribute, so it is
still present and required.  If both "nameValue" and "checkedProperty" are
used, then "property" is ignored (even though it's required).  However, it's
never necessary to use BOTH "nameValue" and "checkedProperty".  Since I've
divided the two purposes of "property" into two attributes, if you use one of
the new attributes, you can still have "property" be used for the other of the
two purposes.

-- 
===================================================================
David M. Karr          ; Best Consulting
[EMAIL PROTECTED]   ; Java/Unix/XML/C++/X ; BrainBench CJ12P (#12004)


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

Reply via email to