日期:2014-05-16  浏览次数:20443 次

Extjs4提交后台无响应
后台用struts2 action
用Extjs4表单提交没有响应
如果直接在地址栏打URL可以进去,没报错,
用Extjs4表单提交到servlet也可以进去,

错就错在用表单提交进不去struts2 action

------解决方案--------------------
//添加类的属性,form提交后是要监听成功否的返回值的,默认就叫success
private boolean success = true;


//get set 
public boolean isSuccess() {
return success;
}

public boolean setSuccess(boolean success) {
this.success=success;
}

如果还不行,就好好检查一下参数有没有提交出去,地址有没有对,action里打上断点看看进去了没有

祝你成功




------解决方案--------------------
用firefox检查一下你的请求是否发出去了,
------解决方案--------------------
extjs用ajax进行提交吧!
如下
JScript code

//修改操作
    function uf_UpdateProjectHandler(){
        var path = document.getElementById("path").value;
        var projectId = document.getElementById("projectId").value;
        if(Ext.getCmp('updateProjectForm').getForm().isValid()){
            var projectName = Ext.getCmp('projectName').getValue();
            var code = Ext.getCmp('code').getValue();
            var state = Ext.getCmp('state').getValue();
            var completePercent = Ext.getCmp('completePercent').getValue();
            var completePhase = Ext.getCmp('completePhase').getValue();
            var startDate = transdate(Ext.getCmp('start').getValue());
            var endDate = transdate(Ext.getCmp('stop').getValue());
            var cycle = Ext.getCmp('cycle').getValue();
            var managers = Ext.getCmp('manager').value;
            var coders = Ext.getCmp('user').value;
            var userId = document.getElementById("userId").value;
            var users;
            if(managers == null || managers == ""){
                users = coders;
                Ext.MessageBox.alert("提示信息","项目管理人不能为空!");
                return false;
            }else if(coders == null || coders == ""){
                users = managers;
            }else{
                users = managers+","+coders;
            }
            Ext.Ajax.request({
                 url:path + '/project/projectAction_updateProject.action',
                 params:{
                     'project.projectId':projectId,
                     'project.name':projectName,
                     'project.code':code,
                     'project.state':state,
                     'project.completePercent':completePercent,
                     'project.completePhase':completePhase,
                     'project.startDate':startDate,
                     'project.endDate':endDate,
                     'project.cycle':cycle,
                     'project.manager':users,
                     'project.updateUserId':userId
                     },
                 method:'post',
                 success:function (response,options) {
                     var result = response.responseText;
                    if(result.length > 0 && result.length <102){
                        if(result == "success") {
                            Ext.MessageBox.alert("提示信息","修改成功!");
                            uf_Reload_data();
                            Ext.getCmp('updateProjectWin').close();
                         }else{
                             Ext.MessageBox.alert("提示信息","出现异常");
                         }
                     }
                 }
                });
        }else{
            Ext.MessageBox.alert("提示信息", "项目信息填写错误,请按照提示修改");
        }
    }