Checkbox "checked" behaviour is inconsistent with documentation.
----------------------------------------------------------------

                 Key: STS-819
                 URL: http://www.stripesframework.org/jira/browse/STS-819
             Project: Stripes
          Issue Type: Bug
          Components: Tag Library
    Affects Versions: Release 1.5.6, Release 1.5.5, Release 1.5.4
            Reporter: Danilo Ghirardelli


There seems to be a problem with the checkbox tag, regarding the behaviour of 
the "checked" attribute.
Steps to reproduce:
- Create a simple bean, even one with just a single Long attribute will do, the 
important thing is that must not be a String.
- Create a formatter for this kind of bean.
- Create a simple actionBean that contains a long list of the bean defined 
above, and a short list of the same beans, containing a few elements of the 
long list. It's a simple case of many to many matching.

Try to render the list like this:
 <c:forEach items="${actionBean.longList}" var="elem" varStatus="status">
    <stripes:checkbox name="elems[${status.index}]" value="${elem}" 
checked="${actionBean.shortList}" />
 </c:forEach>

All checkboxes from the long list are generated, with the correct value, but 
none is selected.
There seems to be something "strange" (at least for my understanding) in the 
class InputCheckBoxTag, lines 114-118:

    public int doEndInputTag() throws JspException {
        // Find out if we have a value from the PopulationStrategy
        Object checked = getOverrideValueOrValues();

        // If the value of this checkbox is contained in the value or override 
value, check it
        getAttributes().put("value", format(this.value));
        if (isItemSelected(this.value, checked)) {

The method isItemSelected is correct, but I don't understand why the "checked" 
object is obtained by getOverrideValueOrValues() and not using the checked 
object already in the class. At least, when the checked attribute is a list, 
the result of getOverrideValueOrValues() seems to be a random element of the 
list, not the list itself, so the isItemSelected method won't work right. Maybe 
is this.value that should be assigned from getOverrideValueOrValues() ?


-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to