1. 程式人生 > >解決SpringMVC返回JSON IE下提示下載

解決SpringMVC返回JSON IE下提示下載

SpringMVC的配置檔案中:

<!--註解驅動 -->
<mvc:annotation-driven>
    <mvc:message-converters>
       <!-- <ref bean="stringHttpMessageConverter"/>-->
        <ref bean="mappingJackson2HttpMessageConverter"/>
    </mvc:message-converters>
</mvc:annotation-driven>
<!--
<bean id="stringHttpMessageConverter"
      class="org.springframework.http.converter.StringHttpMessageConverter"/>-->

<bean id="mappingJackson2HttpMessageConverter"
      class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
    <property name="supportedMediaTypes">
        <list>
            <value>text/html;charset=UTF-8</value>
            <value>application/json;charset=UTF-8</value>
        </list>
    </property>
</bean>

我的配置檔案: