我做的一个修改信息的功能,先根据用户点击的id查出来对应的数据,然后将数据返回前台,我将这些数据,放在了一个table中,然后将table放在这个层里面,然后点击修改,将修改后的数据怎么传到后台Action中?求各位大侠帮忙了!谢谢了
给个思路也行啊

解决方案 »

  1.   

    怎么form提交啊,我是通过ajax跳到Action中,function update(){
             $.ajax({
                url: "student!update.action",
                type: "post",
                data: null,
                cache: false,
                beforeSend: function(result) {
                },
                success: function(result) {
                 alert("成功!");
                 $('#dialog-overlay, #dialog-box').hide();
                },
                error: function(result, status) {
                    if (status == 'error') {
                        alert("系统发生错误");
                    }
                }
            });
            }这里面应该怎么提交啊?
      

  2.   

    <form action="student!update.action" name="updateForm">
    </form>
    function update(){
      document.updateForm.submit();
    }然后在action中。
    request.getpre..("XXX")
      

  3.   

    在update()里面拼一个字符串url在后面加上你要传的参数,type改成get方式,url:字符串,type: "get",
    估计可以达到你要的效果
      

  4.   

    看下这个吧:
    http://topic.csdn.net/u/20080221/15/d47fac18-1542-4d8f-917e-ba138a632023.html
      

  5.   

    你可以先放在form中撒,或者你用ajax提交也可以的
      

  6.   


    items:[
            {x:0,y:5,xtype:'label',text:'昵称:'},
            {x:60,y:0,name: 'username',width:'130' },                    
                    {x:230,y:5,xtype:'label',text:'姓名:'},
            {x:290,y:0,name: '_name',width:'130'},
            
            {x:0,y:35,xtype:'label',text: '密码:'},
            {x:60,y:30,name:'_password',width:'130'},         
            {x:230,y:35,xtype: 'label',text: '重复密码:'},
            {x:290,y:30,name:'doublePass',width:'130'},buttons:[{
                text:'Send',
                handler:function(){   
                 if(perform.form.isValid()){
                 perform.form.submit({
                 url:'/Extjs_Center/personnelAction.do?method=addPersonnel',
                 method:'post',
                 success: function(form,action){
                 if(action.result.msg=='succ'){
                 document.location='../../jsp/personnel/personnelList.jsp';
                 }else{
                 Ext.Msg.alert('false','员工创建失败!');
                 }
                 },
                 failure: function(form,action){
                 Ext.Msg.alert('错误','服务器出现错误请稍后再试!');
                 }            
                 });
                  }
                }    
            },{
                text: 'Cancel'
            }]
    public ActionForward addPersonnel(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response) {
    PersonnelForm frm = (PersonnelForm) form;
                    System.out.println(frm.getUsername()+" "+frm.get_password());
    PersonnelBo pbo = new PersonnelBo();
    pbo.AddPersonnel(response, frm);
    return null;
    }
      

  7.   

    [Quote=引用 3 楼 pipi517 的回复:]
    <form action="student!update.action" name="updateForm">
    </form>
    function update(){
      document.updateForm.submit();
    }然后在action中。
    request.getpre..("XXX")
      

  8.   

    <form action="xxx" >
    ...
    </form>
      

  9.   

    放在form中,然后通过触发事件传递到后台的一个action中!
      

  10.   


    这个方法是取表单name的值。你的表单里都是ID,没NAME怎么取值嘛。你把你ID改成name试试
      

  11.   

    function update(){
                $.ajax({
                url: "student!update.action",
                type: "post",
                data: {
                          //在这里加入你保存的参数值
                     username:"",
                     password:""
                },
                cache: false,
                beforeSend: function(result) {
                },
                success: function(result) {
                    alert("成功!");
                    $('#dialog-overlay, #dialog-box').hide();
                },
                error: function(result, status) {
                    if (status == 'error') {
                        alert("系统发生错误");
                    }
                }
            });
            }
      

  12.   

    function update(){
                    //这里直接根据它们的id取值,得到值后然后将值通过data传到后台
             var id = document.getElementById("id").value;
    var username = document.getElementById("username").value;
    var stuid = document.getElementById("stuid").value;
    var phone = document.getElementById("phone").value;
    var address = document.getElementById("address").value;
    var email = document.getElementById("email").value;
             $.ajax({
                url: "student!change.action",
                type: "post",
                data: ({"id":id,"username":username,"stuid":stuid,"phone":phone,"address":address,"email":email}),//这里就是你要传的值,这里要注意写法
                cache: false,
                beforeSend: function(result) {
                },
                success: function(result) {
                 alert("更新成功!");
                 $('#dialog-overlay, #dialog-box').hide();
                },
                error: function(result, status) {
                    if (status == 'error') {
                        alert("系统发生错误");
                    }
                }
            });
            }