Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3569

s:radio does not select the right option on reading the value

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Not A Problem
    • 2.2.1
    • 2.3.15
    • Plugin - Tags
    • Windows, Glassfish, Maven, Struts, Spring and Tiles

    • Patch

    Description

      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.

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

      Attachments

        Activity

          People

            lukaszlenart Lukasz Lenart
            john.dondapati John Dondapati
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: