将返回的Content-Type由application/json改为text/html。
在struts2下:
<action name="XXXAjax" class="XXXAction"> <result type="json"> <param name="contentType">text/html</param> </result> </action>
在spring3.x mvc下:
HttpHeaders headers = new HttpHeaders(); MediaType mt=new MediaType("text","html",Charset.forName("UTF-8")); headers.setContentType(mt); ResponseEntity<JsonModel> re=null; re=new ResponseEntity<JsonModel>(jsonModel,headers, HttpStatus.OK); return re;