One of the solutions to the http error 302 error reported by the jquery upload plug-in uploadify, jqueryuploadify

Source: Internet
Author: User

One of the solutions to the http error 302 error reported by the jquery upload plug-in uploadify, jqueryuploadify

When the jquery upload plug-in uploadify was used some time ago, the system always reportedHttp error 302.

A large amount of information is collected on the Internet.Session Value LossAccording to the solution provided by netizens, the problem is not solved.

Therefore, it is not ruled out that this is one of the solutions to the 302 error, but I will propose another solution for your reference, considering the problem of asynchronous transmission (I succeeded anyway ).

First, uploadify Initialization:

$ (Function (){
$ ('# Projectfile'). uploadify ({
'Swf ':' $ {ctxStatic}/scripts/jqext/uploadify/uploadify.swf ',
'Upload': '$ {ctx}/utmmanager/utm/insert ',

// The session solution is to add JSESSIONID =$ {pageContext. session. id} to the value of uploader },

'Auto': true, and add a 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> Number of entries imported successfully:" + json_data.successLen + "<br> Number of failed entries: // json data must be returned here,

"+ Json_data.errorLen +" <br> failed import entry: <br> "+ json_data.errorData); not a jump path. For details, see the following analysis.
},
'Onuploaderror': function (){
Alert ("failed ");
}
});
});

The second is the Controller method:

@ ResponseBody needs to be added

@ Responsebody indicates that the returned results of this method are directly written to the HTTP response body, which is generally used to obtain data asynchronously.

After @ RequestMapping is used, the returned values are usually parsed as jump paths. After @ responsebody is added, the returned results are not parsed as jump paths,

Instead, it is directly written into the HTTP response body. For example, json data is obtained asynchronously. After @ responsebody is added, json data is directly returned.

Purpose:

This annotation is used to convert an object returned by the Controller method to a specified format through an appropriate HttpMessageConverter,

Write to the body data area of the Response object.

Timing:

The returned data is not an html Tag page, but is used for data in other formats (such as json and xml;

 

 

 

 

Chocoo

2016.4.18

 

Certificate ------------------------------------------------------------------------------------------------------------------------------------------------

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.