<td class="altbg2">
<input type="text" size="3" value=""id="qty" />
</td>
<td class="altbg2">
<a href="update.do?id=<%=item.getComputer().getId()%>‘这里该怎么写,才能得到上面的id为qty的编辑框的值,然后交给Servlet(update.do)去处理’">更改数量</a>
</td>

解决方案 »

  1.   

    没法直接写
    用js吧
    <a   href= "#" onclick="aa('<%=item.getComputer().getId()%>')"> 更改数量 </a>
    function aa(val){
    var url = "update.do?id="+val+"&qty="+document.getElmentById("qty").value;
    this.location = url;
    //或者如果有form的话
    //document.forms[0].action = url;
    //document.forms[0].submit();

      

  2.   

    <a   href= "update.do?id= <%=item.getComputer().getId()%> ‘
    修改为
    <a href="#" onclick="window.self.location=‘update.do?id=' + document.getElementById('qty').value"/>
      

  3.   

    <a href="javaScript:location.href='update.do?id=' + document.getElementById('qty').value"/>
      

  4.   

    把那个值放进jsp内置对象request中  然后在需要的地方取出来  页面最好用EL/JSTL 表达式
      

  5.   

    <a   href= "update.do?id= <%=item.getComputer().getId()%> 更改数量 </a> 
    改成 <a href="# return false;" onclick="getQty(<%=item.getComputer().getId()%>)">更改数量 </a> 
    <script language="javascript">
    function getQty(id){
       var qty = document.getElementById("qty").value;
       window.location.href="update.do?id="+id+"&qty="+qty;
    }
      

  6.   

    好了吧,还是老师帮忙解决了问题
    <a href="javascript:;" onclick="location='update.do?id=<%=item.getComputer().getId()%>&qty='+document.getElementById('q_<%=item.getComputer().getId() %>').value">更改数量</a>