You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Luis Gervaso Martin (JIRA)" <ji...@apache.org> on 2009/02/25 06:25:46 UTC

[jira] Updated: (WW-3007) org.apache.struts2.util.ContainUtil.contains

     [ https://issues.apache.org/struts/browse/WW-3007?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luis Gervaso Martin updated WW-3007:
------------------------------------


I foound another way to solve this

in checkboxlist.ftl (theme : simple)

there is

<#assign itemKeyStr=itemKey.toString() />
<input type="checkbox" name="${parameters.name?html}" value="${itemKeyStr?html}" id="${parameters.name?html}-${itemCount}"<#rt/>
        <#if tag.contains(parameters.nameValue, itemKey)>

if you change the last line to <#if tag.contains(parameters.nameValue, itemKeyStr)>

this also works for me

> org.apache.struts2.util.ContainUtil.contains
> --------------------------------------------
>
>                 Key: WW-3007
>                 URL: https://issues.apache.org/struts/browse/WW-3007
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Expression Language
>    Affects Versions: 2.1.6
>         Environment: All
>            Reporter: Luis Gervaso Martin
>
> When we use a 
> String[] selectedValues in the Action and the beans keys are for example Long this is not working
> <@s.checkboxlist name="selectedValues" list=q.choices listKey="id" listValue="label" />
> (id is a Long)
> It's working if we use a java.util.List selectedValues
> The issue comes from ContainUtil class
> In arrays we don't check the String value
> if (obj1 instanceof Iterable) {
> ...
> if (obj2.equals(value) || obj2.toString().equals(value)) { //(works ok)
> BUT
>  } else if (obj1.getClass().isArray()) {
> ...
> if (value.equals(obj2)) { //(it's not working)
> Thanks
> Luis
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.