加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ajax submit 在IE下提示下载

发布时间:2020-12-16 01:28:26 所属栏目:百科 来源:网络整理
导读:转载自:http://ldzyz007.iteye.com/blog/2068440 1.修改: contentType 为text/html 2.注解修改如下: @RequestMapping(value = "/save",method = RequestMethod.POST,produces = "application/json;charset=UTF-8") @ResponseBody 改为 3.其他解决方法(本

转载自:http://ldzyz007.iteye.com/blog/2068440

1.修改: contentType 为text/html


2.注解修改如下:
@RequestMapping(value = "/save",method = RequestMethod.POST,produces = "application/json;charset=UTF-8")
@ResponseBody

改为

3.其他解决方法(本人没用到):
在IE9下,将json字符串用下面的格式返回给客户端
<body>
<pre>{"message":"保存成功","data":null,"success":true}</pre>

</body>

本人部分代码如下:

@RequestMapping(value = "/importExcel/check",produces = "text/htm;charset=UTF-8")
	@ResponseBody
	public Result importExcelView(MultipartFile file,HttpServletResponse response) throws Exception {
		
		response.setContentType("text/html;charset=utf-8");

补充:

发现返回数据为:

<h1>HTTP Status 406 - </h1><hr size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers ().</u></p><hr size="1" noshade="noshade"><h3>Apache Tomcat/7.0.26</h3>
解决办法:将 返回 类型 Result 改为 String 类型。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读