SpringMVC配置JSON接收参数字段多于后台字段

来源:互联网 发布:柬埔寨网络博客 编辑:程序博客网 时间:2024/05/11 09:35

项目需要实现前台传递多个参数,但后台只接受少数参数。所以上网得到的结果如下所示。

FastJSON实现

    <mvc:annotation-driven>        <mvc:message-converters register-defaults="true">            <bean class="org.springframework.http.converter.StringHttpMessageConverter">                <property name="supportedMediaTypes" value="text/html;charset=UTF-8"/>            </bean>            <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">                <property name="supportedMediaTypes">                    <list>                        <value>application/json;charset=UTF-8</value>                    </list>                </property>            </bean>        </mvc:message-converters>    </mvc:annotation-driven>

参考:
http://blog.fengxiaotx.com/archives/269

原创粉丝点击