第一段代码可以正常运行,第二段怎么就不行呢<s:iterator value="types">
       <input type="radio" name="type" onclick="getDicName('<s:property value="typeid"/>',
             '<s:property value="name"/>')"><s:property value="name"/>
</s:iterator>第一段代码,查看源码是<input type="radio" name="type" onclick="getDicName('2','瑜伽')">瑜伽
第二段代码,查看源码只是 getDicName('typeid','name')
<s:iterator value="types">
<s:radio name="type" list="name" onclick="getDicName('typeid','name')"/>
</s:iterator>
第二段怎么改写才可以呢,请大侠赐教,谢谢

解决方案 »

  1.   

    Struts2的标签不能嵌套 郁闷
      

  2.   

      解决方式
      <s:radio name="type" list="addOrSubList" listKey="code" listValue="codeVal" onclick="getName(this.value,this.nextSibling.innerText)"/>
        list:一个list   listkey:list中对象的code属性    listValue:list中对象的codeVal属性  解析成HTML的元素   其中  HTML中的value : 上面的listValue
      而onclick事情中,是使用js来获取元素值,this.value = radio对象的value
      this.nextSibling  在同级中的下一个元素 的 innerText内容  
      了解下js的代码就能看懂
    <input type="radio" name="type" id="type0" value="0" onclick="getNamethis.value,this.nextSibling.innerText)"/>
    <label for="type0">未减人员</label>
    <input type="radio" name="type" id="type1" value="1" onclick="getName(this.value,this.nextSibling.innerText)"/>
    <label for="type1">已减人员</label>
      

  3.   

    试了各种方法 <s:radio name="type" list="name" onclick="getDicName('typeid','name')"/>
    typeid,name始终都是被当作一个字符串而不是表达式
      

  4.   

    <s:iterator value="types">  <s:radio name="type" list="name" onclick="getDicName('typeid','name')"/> </s:iterator>按5楼的做法,把<s:iterator value="types"> 去掉了吗?
      

  5.   

    去掉了还是不行<s:radio name="type" list="types" listKey="name" listValue="name" onclick="getDicName('this.typeid','this.name')" theme="simple"/>
      

  6.   

    <s:radio name="type" list="addOrSubList" listKey="code" listValue="codeVal" onclick="getName(this.value,this.nextSibling.innerText)"/> 
    getName(this.value,this.nextSibling.innerText)  在参数上不要添加引号。
    俩个参数是通过 js的对象来获取的
    <s:radio /> 
    标签解析成 
    <input type="radio" name="type" id="type0" value="0" onclick="getName(this.value,this.nextSibling.innerText)"/> 
    <label for="type0">未减人员 </label> 
    <input type="radio" name="type" id="type1" value="1" onclick="getName(this.value,this.nextSibling.innerText)"/> 
    <label for="type1">已减人员 </label>你要看清楚引号的位置
      

  7.   

    参数用表达式。或者是用标签。不能直接写。直接写会输出源码。<font color="red">我爱你</font>如果这样子的回输出源码。。
      

  8.   

    J2EE高级群:71929019
    期待高手的加入