ajax submit 在IE下提示下载

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

1.修改: contentType 为text/html 


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

改为 
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = "text/htm;charset=UTF-8")  
@ResponseBody 

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

</body> 

本人部分代码如下:

@RequestMapping(value = "/importExcel/check", method = RequestMethod.POST,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 类型。


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值