当前位置: 代码迷 >> J2EE >> 返回的json都报这个错解决办法
  详细解决方案

返回的json都报这个错解决办法

热度:235   发布时间:2016-04-19 21:59:07.0
返回的json都报这个错
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();
}

为什么总是报这个问题Resource interpreted as Document but transferred with MIME type application/json
------解决方案--------------------
你都不看问题报出来的意思,很明显是你文件的格式问题
  相关解决方案