You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Greg Huber (JIRA)" <ji...@apache.org> on 2013/08/21 13:10:52 UTC

[jira] [Comment Edited] (WW-4181) s:radio not selecting initial value correctly

    [ https://issues.apache.org/jira/browse/WW-4181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13745946#comment-13745946 ] 

Greg Huber edited comment on WW-4181 at 8/21/13 11:10 AM:
----------------------------------------------------------

Hello,

On further testing we seem to have to modify the isChecked(..) method used in checkboxlist to:

<code>
private Boolean isChecked(Map<String, Object> params, String itemKeyStr) {
        Boolean checked = false;
        if (itemKeyStr != null) {

            // NameValue are the values that is provided by the name property
            // in the action
            Object nameValue = params.get("nameValue");

            Iterator itt = MakeIterator.convert(nameValue);
            while (itt.hasNext()) {

                String value = (String) itt.next();
                if (checked = value.equalsIgnoreCase(itemKeyStr)) {
                    break;
                }

            }

        }
        return checked;
    }
<code>

Which will handle both arrays and single strings in the name property.  Maybe this also needs to done on the checkboxlist? as if you do not use a String[] in name we get a class cast exception.

Cheers Greg.
                
      was (Author: gregh99):
    Hello,

On further testing we seem to have to modify the isChecked(..) method used in checkboxlist to:

<code>
private Boolean isChecked(Map<String, Object> params, String itemKeyStr) {
        Boolean checked = false;
        if (itemKeyStr != null) {

            // NameValue are the values that is provided by the name property
            // in the action
            Object nameValue = params.get("nameValue");

            Iterator itt = MakeIterator.convert(nameValue);
            while (itt.hasNext()) {

                String value = (String) itt.next();
                if (checked = value.equalsIgnoreCase(itemKeyStr)) {
                    break;
                }

            }

        }
        return checked;
    }
<code>

Which will handle both arrays and single strings in the name property.  Maybe this also needs to done on the checkboxlist? as if you do not use a String[] in name we get a class cast exception.

Cheers Greg.



Cheers Greg.
                  
> s:radio not selecting initial value correctly
> ---------------------------------------------
>
>                 Key: WW-4181
>                 URL: https://issues.apache.org/jira/browse/WW-4181
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Java Templates
>    Affects Versions: 2.3.15.1
>         Environment: Tomcat/centos
>            Reporter: Greg Huber
>            Priority: Minor
>         Attachments: radiohandler.patch
>
>
> Hello,
> The s:radio is not selecting its initial value correctly.  We need the same mods as in checkboxlist ie
> private Boolean isChecked(Map<String, Object> params, String itemKeyStr) 
> method.
> Cheers Greg

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira