When the jquery upload plugin uploadify was used in the previous period, there was always an error 302 the System reporting HTTP error.
On-line collection of information, basically, the session value is lost , according to the solution provided by users to modify, the problem is not resolved.
So, not to rule out that this is one of the workarounds for solving the 302 error, but I'm going to come up with another solution that takes into account the problem of asynchronous transmission for your reference (I succeeded anyway).
the first is uploadify initialization :
$ (function () {
$ (' #projectfile '). Uploadify ({
' swf ': ' ${ctxstatic}/scripts/jqext/uploadify/uploadify.swf ',
' Uploader ': ' ${ctx}/utmmanager/utm/insert ',
The scenario for the session is to add the value of this uploader: jsessionid=${pagecontext.session.id},
' auto ': true, and add one line ' FormData ': {' jsessionid ': ' ${pagecontext.session.id} '},
' ButtonText ': ' Import ',
' Multi ': false,
' Fileobjname ': ' File ',
' method ': ' Post ',
' Onuploadsuccess ': function (file,data,response) {
var json_data=eval ("(" +data+ ")");
Alert ("<br> successfully imported entries:" +json_data.successlen+ "<br> failed import entry number://The JSON data needs to be returned here,
"+json_data.errorlen+" <br> Import failed entry:<br> "+json_data.errordata); is not a jump path. See below for more detailed analysis.
},
' Onuploaderror ': function () {
Alert ("failure");
}
});
});
Next is the Controller method:
Need to add @responsebody
@responsebody indicates that the return result of the method is written directly to the HTTP response body, which is generally used when fetching data asynchronously.
After using @requestmapping, the return value is usually resolved to a jump path , and the returned result is not resolved to a jump path after the @responsebody is added.
Instead, it is written directly to the HTTP response body. For example, asynchronously fetching JSON data, plus @responsebody, will return the JSON data directly.
function:
The annotation is used to convert the object returned by the controller's method to the specified format by the appropriate httpmessageconverter.
Writes to the body data area of the response object.
Time:
The returned data is not a page of HTML tags, but is used in some other form of data (JSON, XML, etc.);
Chocoo
2016.4.18
----------------------------------------------------------------------------------------------------------- -------------------------------------
jquery Upload Plugin uploadify error HTTP Error 302 workaround one of the workarounds