Let's talk about the environment.
Easyui+springmvc+mybatis
Because by normal means, can not use Ajax to submit a form containing files, so think of using Easyui form to submit, Easyui form encapsulated a set of pseudo-Ajax submission method, so can play the role of the Ajax file form!
However, when the file submitted successfully, back to the back of the background a JSON to prompt the upload success!
But in other browsers are normal, but only in IE will prompt users to download this JSON file!
Look carefully at the next Easyui API to see that there is a passage in the API:
That is, the returned data does not need to set the corresponding type of the return value, but instead returns the JSON-formatted text directly!
So, I set the corresponding type of responsed in the corresponding action
Response.setcontenttype ("Text/html;charset=utf-8")
But the problem is still, and then I open the myeclipse there is a TCPIP port monitoring tool, the corresponding format is empty
This means that the corresponding type of Setup does not work,
Then I remember, I configured the JSON converter in the configuration file.
This sets the corresponding type to JSON, that is, the type of final response is still the JSON type, so
In allowing the corresponding list to add a
Then in the foreground you need to format the returned text as a JSON object in two ways
1,var obj= "(" +data+ ")";
2,var Obj=$.parsejson (data);
And then test the perfect pass, no longer prompted to download the file!
"Springmvc" "Easyui" about using Easyuiform upload file, return jsonie prompt download file solution!