2014年5月22日星期四

Return json have reported this error

ProductManagerForm form = (ProductManagerForm) getBaseForm (context);
FormFile attachFile = form.getAttachFile ();

if (attachFile.getFileSize ()> 10 * 1024 * 1024) {
String result = "{\" message \ ": \" failed \ "}";
context.getResponse () setContentType ("application / json; charset = UTF-8").;
context.getResponse () getWriter () write (result)..;
context.getResponse () getWriter () close ()..;
} else {
String result = "{\" message \ ": \" success \ "}";
context.getResponse () setContentType ("application / json; charset = UTF-8").;
context.getResponse () getWriter () write (result)..;
context.getResponse () getWriter () close ()..;
}

Why always reported this problem Resource interpreted as Document but transferred with MIME type application / json
------ Solution --------- -----------------------------------
you do not see the problem reported out mean , obviously is the format
------ For reference only your files -------------------------------- -------
client service always reported this problem Resource interpreted as Document but transferred with MIME type application / json

catch exception is : SyntaxError: Unexpected token << br> ------ For reference only --------------------- ------------------

I am today with $ ajaxFileUpload this framework the problem
------ For reference only. - -------------------------------------
solve the problem, set reponse.setContentType (" ; text / html; charset = UTF-8 ");
------ For reference only ------------------------- --------------
I have encountered this problem, I do not know how to change the ==

没有评论:

发表评论