JSP中 while(Rs.next()) 代码
  <%while(Rs.next()){ %>
  <textarea id="rep<%=i%>"name="mo_reply<%=i%>" rows="1" cols="50" ></textarea>
  <html:link action="/addmoodreply.do" ><img src="images/other/ensure.png"/></html:link>&nbsp;取消
  <%}Rs.close();%>如果rs.next循环了三次 会生成3个textarea <textarea id="rep1"name="mo_reply1" rows="1" cols="50" ></textarea>
 <html:link action="/addmoodreply.do" ><img src="images/other/ensure.png"/></html:link>&nbsp;取消
 <textarea id="rep2"name="mo_reply2" rows="1" cols="50" ></textarea>
 <html:link action="/addmoodreply.do" ><img src="images/other/ensure.png"/></html:link>&nbsp;取消
 <textarea id="rep3"name="mo_reply3" rows="1" cols="50" ></textarea>
 <html:link action="/addmoodreply.do" ><img src="images/other/ensure.png"/></html:link>&nbsp;取消
   怎么在Action中  获得对应textarea 里的内容呢

解决方案 »

  1.   

    应该要3个都取了吧~之后再判断,,,textarea同名然后action里面用数组获取????求高手...- -
      

  2.   

    <%while(Rs.next()){ %>
      <textarea id="rep<%=i%>"name="mo_reply" rows="1" cols="50" ></textarea>
      <html:link action="/addmoodreply.do" ><img src="images/other/ensure.png"/></html:link>&nbsp;取消
      <%}Rs.close();%>1. name用相同的名字,在Action里取数据里时候用request.getParameterValues("mo_reply");会得到一个数组。
    2. 你再循环这个数组得到你想要的数据就OK了
      

  3.   

    还是不行啊 Action 那边得到的是null   各位在帮帮忙吧
      

  4.   

    把你的所有参数都打出来,看看有mo_reply这个名字吗?如果没有,说明你的页面没改过来。Enumeration e = request.getParameterNames();
    while(e.hasMoreElements()){
     System.out.println(e.nextElement());
    }
      

  5.   

    试了一下 没有  request.getParameterValues("这里面不是填textarea的 name值吗?");Enumeration e = request.getParameterNames(); 这个是得到页面参数的名字吧 到底怎么取呢  有点晕了
      

  6.   


      <textarea id="rep<%=i%>"name="mo_reply<%=i%>" rows="1" cols="50" ></textarea>
      =><textarea id="rep<%=i%>"name="mo_reply" rows="1" cols="50" ></textarea>
      那个name不用变了吧,我只记得checkbox都用的相同的名字,然后你用2楼的方法在action里通过
    request.getParameterValues("mo_reply");试试!