1

我在提交 ExtJs 表单时遇到问题。我无法获得success功能。

我有:

formp = new Ext.FormPanel({
 fileUpload: true,
 width: 350,
 autoHeight: true,
 bodyStyle: 'padding: 10px 10px 10px 10px;',
 labelWidth: 70,
 defaults: {
  anchor: '95%',
  allowBlank: false,
  msgTarget: 'side'
 },
 items:[{
xtype: 'fileuploadfield',
id: 'filedata',
emptyText: 'Выберите файл для загрузки...',
    fieldLabel: 'Имя файла',
buttonText: 'Обзор'
 }],
 buttons: [{
text: 'Загрузить',
handler: function(){
formp.getForm().submit({
  url: url_servlet+'doUpload.jsp',
  success: function(formp, o) {
      alert(o.responseText);    
      }
                                             })
                                            }
 }]
})

在 doUpload.jsp 我有out.println("1111"); 在 fireBug 我看到doUpload.jspPOST1111但没有警报。怎么了?

4

1 回答 1

0

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.Basic-method-submit

//Respone object
out.println("{success:true, file:'11111'}");

//Submitting the form. The second parameter in the success callback is
//your response object. You can access it properties as shown below.
formp.getForm().submit({
  url: url_servlet+'doUpload.jsp',
  success: function(formp, o) {
      alert(o.result.file);    
  }
});
于 2012-07-11T08:26:36.087 回答