You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (JIRA)" <ji...@apache.org> on 2013/05/20 14:29:17 UTC

[jira] [Commented] (WW-3569) s:radio does not select the right option on reading the value

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

Lukasz Lenart commented on WW-3569:
-----------------------------------

What [~jogep] presented simply means that the nameValue parameter is already specified if you defined {{value}} attribute. If {{value}} attribute is missing, UIBean will use {{name}} attribute to find value on stack.
                
> s:radio does not select the right option on reading the value
> -------------------------------------------------------------
>
>                 Key: WW-3569
>                 URL: https://issues.apache.org/jira/browse/WW-3569
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.2.1
>         Environment: Windows, Glassfish, Maven, Struts, Spring and Tiles
>            Reporter: John Dondapati
>            Priority: Minor
>              Labels: nameValue, s:radio
>             Fix For: 2.3.15
>
>
> The template.simple.radiomap.ftl has the following code to check if the name expression value contains itemKeyString but the parameters.nameValue does not exist. 
> {code:xml}
> <#if parameters.name??>
>  name="${parameters.name?html}" nmv="${nameValue?html} <#rt/>
> </#if>
>  id="${parameters.id?html}${itemKeyStr?html}" <#rt/>
> <#if tag.contains(parameters.nameValue?default(''), itemKeyStr)> 
>  checked="checked" <#rt/>
> </#if>
> Replace this part of the file with the following and it seems to work fine as we now assign a variable with name "nameValue" with value from the el in parameters.name. Then check against itemKeyStr using this value to select that option for the radio group.
> <#if parameters.name??>
> <#--/*add this line*/-->
>         <#assign nameValue = stack.findString(parameters.name)/> 
>  name="${parameters.name?html}" nmv="${nameValue?html} <#rt/>
> </#if>
>  id="${parameters.id?html}${itemKeyStr?html}" <#rt/>
> <#--/*remove this line*/-->
> <#if tag.contains(parameters.nameValue?default(''), itemKeyStr)> 
> <#--/*add this line*/-->
> <#if tag.contains(nameValue, itemKeyStr) == true> 
>  checked="checked" <#rt/>
> </#if>
> {code}

--
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