在Struts中,如何获取<input type="radio" name="recordRadio" value="<%=index %>"/>的index 呢?或者能获取到<logic:iterate id="easp010Array" name="easp010" scope="page" indexId="index">的indexid也行,各位大哥帮帮忙,今天搞不定我就不能回家过年了。谢谢了
代码:
<logic:iterate id="easp021Array" name="easp021" scope="page" indexId="index">
      <tr class="<%=bgStyle%>">
    <td class="center">
       <input type="radio" name="recordRadio" value="<%=index %>"/>
    </td>
<td>
   <bean:write name="easp021Array"
                     property="idpam" 
                         scope="page" 
                         ignore="true" />   
             </td>

解决方案 »

  1.   


    <logic:iterate id="easp021Array" name="easp021" scope="page" indexId="index"> 
    <input type="radio" name="recordRadio" value="<%=index.intValue()%>"/>
    啊?你要过年回家啦,看来年前这分你是不会给我了
      

  2.   

    放心,我在线等着的
      java的ACTION里面怎么写呢?谢谢了
      

  3.   

    你在ACTION中要获取index的值吗?
    如果是的话,那可是多个值,这涉及到另外一个问题了,多行提交,要给你说起来可就比较麻烦了
      

  4.   

    是的,我要在Action中获取我选择的行号,然后再来操作这行的数据。如果有办法能直接获取我选择的这行的数据,那也可以。麻烦你了,大哥
     谢谢
      

  5.   

    action中对于实体的操作可以直接存储到request作用域里,
    request.setAttribute("easp021Array",easp021Array);
      

  6.   

    action里这样写String[] indexStr = request.getParameterValues("recordRadio");
    indexStr这个数组就是你选中的行号
      

  7.   

    给你想了个简单点的笨办法,在form中用个String[]来封装提交上来的radio值private String[] recordRadio = null;    /**
         * recordRadio.
         *
         * @return recordRadio
         * @see #recordRadio
         */
        public String[] getRecordRadio() {
            return recordRadio;
        }    /**
         * recordRadio.
         *
         * @param recordRadio
         * @see #recordRadio
         */
        public void setRecordRadio(String[] recordRadio) {
            this.recordRadio = recordRadio;
        }这样就能得到了你试一下吧,都叫我大哥了,本来我都下班了的,好用了的话来说一声,我就回了
      

  8.   

    大哥,还是不行
    报错,recordRadio的值好像应该是BigDecimal的.而且我的JSP页面里面,是写成<input   type="radio"   name="recordRadio"   value=" <%=index   %> "/> 
    还是写成<input type="radio" name="recordRadio" value="<%=index.intValue()%>"/>
    呢?
     谢谢了哟