JSP 页面中我做了这么一个 TABLE :<table border="1" cellpadding="3" cellspacing="3">
        <tr>
        <th>登录ID</th>
        <th>用户密码</th>
        <th>用户姓名</th>
        </tr>
      <c:forEach var="user" items="${sessionScope.ListUser}" >
        <tr>
          <td>${user.userId}          </td>
          <td>${user.passward}          </td>
          <td>${user.userName}          </td>
<td>
<input type="button"  value="编辑" onclick="javascript:window.open('editUserAction.do?userId=${user.userId}','','width=650,height=500,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');">
</td>
**********************************************
     我试图用“编辑”按钮触发的action  editUserAction 对userId 为Table中的user.userId 数据项进行编辑,但是传参似乎不行??editUser.jsp页面内text中全都是空的,也就是没有传参成功。有人告诉我必须是form 才能传参,我不晓得talbe能不能???

解决方案 »

  1.   

    必须在form标签内的input标签才能提交到别的页面
      

  2.   

     是的,只能通过form 提交数据 ,要不就通过session了,但不建议这种办法。
      

  3.   

    按钮写在一个form里面,然后在form表单里面提交过去!
      

  4.   

    不通过form照样可以传参啊
    为什么不把编辑报称一个超链接形式的,直接用href连接到相应的Action
    也可以用location.href
    如果要用button的话,当onclick发生时,让它调用一个function了,你这样写层次很是不清,最好是写在一个javascript的function中
      

  5.   

    你这是URL重写传参,跟FORM没有关系
    你页面没取得到值,那是你其它地方取值或者存值的问题
    反正在ACTION应该取得到值
      

  6.   

    你要在ACTION中把userId取出来,然后再存起来,最后在editUser.jsp中才能取噻
      

  7.   

    我将原来的BUTTON 改成如下的超链接形式
    <a href="javascript:window.open('editSWYHAction.do?gddh=${swyh.gddh}','','width=650,height=500,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');">编辑</a>
    原来的页面也会做出动作,变成一个空页 有句" [object] "
    **************************
    回chenqi3166:在editAction 中我做了userId的取出工作,但似乎无效,代码部分如下
    ****************************************
    public class EditSWYHAction extends Action {
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request,HttpServletResponse response){
    //声明操作数据库的类
    int gddh = Integer.parseInt(request.getParameter("gddh").trim());
    DBManager bm = new DBManager();
    if (request.getParameter("gddh")!= null){
    //从request对象中取得gddh的属性值
    //SWYH对象
    Swyh swyh =null;
    //判断request中的action对象是否为null
    if (request.getParameter("action")!=null){
    //判断request中的action是否为updata
    if ( request.getParameter("action").equals("updata")){
    //创建SWYH对象
    swyh = new Swyh();
    //设置 xm 属性
    swyh.setXm(request.getParameter("xm"));
    swyh.setGddh(Integer.parseInt(request.getParameter("gddh").trim()));
    swyh.setKhrq(request.getParameter("khrq"));
    swyh.setDw(request.getParameter("dw"));
    swyh.setFws(request.getParameter("fws"));
    swyh.setSzd(request.getParameter("szd"));
    swyh.setZz(request.getParameter("zz"));
    ///////////////////////////
    boolean result = bm.updataSwyh(swyh);
    //将结果保存到result中
    request.setAttribute("result", result);
    }
    }else {
    //如果操作不为updata就会从数据库中查询SWYH信息
    swyh = bm.getSwyh(gddh);
    }
    //在request中设置Swyh 属性
    request.setAttribute("Swyh", swyh);
    }
    return mapping.findForward("editSWYH");
    }
    }
    在 DBManager 中getSwyh()如下:
    public Swyh getSwyh(int gddh){
    //通过Session 从数据库中取得SWYH 信息
    Swyh swyh = (Swyh) session.load(Swyh.class,new Integer(gddh) );
    //提交事务
    transaction.commit();
    return swyh;
    }
      

  8.   

    也许问题在于ACTION里面到底参数传递过去了与否,从search页面到action,再从action到edit的页面,哪一步传到了,哪一步没有成功,如果能更正确就好了。其实很着急,但是想不到解决办法。