The standard way to tackle AJAX calls with JSON results in my current project uses an extended version of Spring’s JsonView class. It worked quite well until I used an ExtJS FormPanel with the property fileUpload set to true. Have a look at the code bellow and then I’ll describe the problem.
The panel looks like:
var uploadOuterPanel = new Ext.FormPanel( {
fileUpload :true,
// Other properties omitted
items : {
allowBlank :false,
id :'file',
inputType :'file',
name :'myFile',
fieldLabel :'File',
blankText :'Please choose a file',
anchor :'95%',
required :true,
autoShow :true,
xtype :'textfield'
},
buttonAlign: 'left',
buttons : [ {
text :'Upload',
handler : function() {
if (uploadOuterPanel.getForm().isValid()) {
uploadOuterPanel.getForm().submit( {
url :'',
waitMsg :'Uploading your file...',
success : function(form, action) {
Ext.Msg.alert('Success', 'File processed successfuly!');
},
failure : // Handle failure omitted
});
}
}
} ]
});
The Controller looks like:
Home
Community