`

Ext学习中,遇到的问题真不少。其中一个action.result.msg为空

阅读更多
Ext.onReady(function(){

   Ext.QuickTips.init();
   var msg = function(title, msg){
        Ext.Msg.show({
            title: title,
            msg: msg,
            minWidth: 200,
            modal: true,
            icon: Ext.Msg.INFO,
            buttons: Ext.Msg.OK
        });
   };
   var fp = new Ext.FormPanel({
        renderTo: 'fi-form',
        fileUpload: true,
        width: 500,
        frame: true,
        title: '上传文件',
        autoHeight: true,
        bodyStyle: 'padding: 10px 10px 0 10px;',
        labelWidth: 60,
        defaults: {
            anchor: '95%',
            allowBlank: false,
            msgTarget: 'side'
        },
        items: [{
            xtype: 'textfield',
            fieldLabel: '组 名',
id: 'txtfile',
name: 'txtfile',
inputType: 'text' //文件类型
        },{
            xtype: 'fileuploadfield',
            id: 'ffile',
            emptyText: '请选择文件',
            fieldLabel: '文件路径',
            name: 'fpath',
            buttonCfg: {
                text: '',
                iconCls: 'upload-icon'
            }
        },{
    xtype: 'textfield',
fieldLabel: '信 息',
id:'txtinfor',
name: 'txtinfor',
inputType: 'text'
}],
        buttons: [{
            text: '上 传',
            handler: function(){
                if(fp.getForm().isValid()){
                fp.getForm().submit({
                    url: '/proExam1/UploadFile',
                    waitMsg: '正在上传,请稍后.....',
                    method:'POST',
                    waitTile:'提示',
                    success: function(fp,action){
                       Ext.MessageBox.alert('提示',"fsdfsd"+action.result.msg); //msg('信 息', ""+action.result.msg);
                    }
                }); 
                }
            }
        },{
            text: '取 消',
            handler: function(){
                fp.getForm().reset();
            }
        }]
    });
});
</head>
<body>
<div id="fi-form"></div>
</body>
</html>
以上是一个客户端的html
然后提交到servlet或者action都行的。
问题主要是我提交后,没有的到是否提交成功后者失败的信息提示.
function(fp,action){
                       Ext.MessageBox.alert('提示',"fsdfsd"+action.result.msg); //msg('信 息', ""+action.result.msg);
这里可是写了的。
刚开始我打印action,发现有值。然后打印action.result为undefined,晕了半天发现时再servlet中的一个print的问题.
记住使用out.print("{success:true,msg:'fsdfds'}");
success是对应表单的success函数
result.msg对应的是servlet中的msg,明白这些后就不会出现为空的值了
分享到:
评论
1 楼 乐章伦 2014-06-14  
为什么我写的action.result.msg 也为空呢,我实在是看不出来 了,帮我看看吧,我的QQ:534549518,谢谢!

相关推荐

Global site tag (gtag.js) - Google Analytics