struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmk...@earthlink.net (David M. Karr)
Subject Re: Proposal: Add "nameValue" and "checkedProperty" to "radio" (and "checkbox"?)
Date Wed, 02 Jan 2002 23:24:21 GMT
>>>>> "David" == David M Karr <dmkarr@earthlink.net> 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
dmkarr@earthlink.net   ; Java/Unix/XML/C++/X ; BrainBench CJ12P (#12004)


--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>


Mime
View raw message