spring-MVC配置问题
来源:互联网 发布:植鞣革皮带 知乎 编辑:程序博客网 时间:2024/05/17 23:26
在配置 json格式转换时,为解决IE环境下点击保存,提示下载json文件,将
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes" value="text/plain;charset=UTF-8" />
</bean>
<!-- 避免IE执行AJAX时,返回JSON出现下载文件 -->
<!-- <bean
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes" value="text/plain;charset=UTF-8" />
</bean> -->
<!-- <bean class="cn.org.zhac.pe.resolver.FastJsonArgumentResolver"/> -->
<!-- 采用阿里巴巴所编写的json转换 -->
<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"/>
</mvc:message-converters>
</mvc:annotation-driven>
改为如下:
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes" value="text/html;charset=UTF-8" />
</bean>
<!--采用阿里巴巴所编写的json转换-->
<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter" >
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
但在服务器上,谷歌chrome环境下,点击保存时,提示:net::ERR_CONTENT_LENGTH_MISMATCH
解决方法如下:
将
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes" value="text/plain;charset=UTF-8" />
</bean>
<!--采用阿里巴巴所编写的json转换-->
<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter" >
<property name="supportedMediaTypes">
<list>
<value>text/plain;charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
- spring-MVC配置问题
- Spring MVC prefix 配置问题
- spring mvc 配置 / 与 /* 问题
- spring MVC 环境配置问题
- 关于Spring MVC I18N 的配置问题
- spring mvc 和mybatis配置相关问题
- spring-mvc注解web.xml配置问题
- spring mvc <mvc:annotation-driven>配置使用出现问题
- spring mvc <mvc:annotation-driven>配置使用出现问题
- 【spring mvc】spring-mvc配置
- Spring MVC 配置
- Spring MVC 配置--解剖
- spring web mvc配置
- Spring MVC 相关配置
- Spring MVC 配置
- Spring MVC国际化配置
- Spring MVC 配置--解剖
- Spring MVC 配置
- 各类程序员学习路线图
- Hibernate分页查询小结
- [C/C++]_[初级]_[编程容易犯错的地方]
- c语言中宏定义的用法
- CSS样式常用的兼容hack写法
- spring-MVC配置问题
- static关键字的作用
- Tomcat并发数优化总结
- guid 在线生成
- java 汉字转换英文小写工具类
- ehcache 缓存使用
- 预编译头文件来自编译器的早期版本,或者预编译头为 C++ 而在 C 中使用它(或相反)
- 大数据落地关键,百思可(BASIC)模型五要素缺一不可
- 6 - 对象和类