步骤1:将json包引入工程中,分别是:jackson-annotations-2.7.0.jar,jackson-core-2.7.0.jar,jackson-databind-2.7.0.jar

步骤2:配置springmvc的配置文件,也就是配置JSON解析器,代码如下:

    <mvc:annotation-driven>
         <mvc:message-converters>
            <bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
            <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
           </mvc:message-converters>
       </mvc:annotation-driven>

然后可以正常传递json对象的数据了。

相关文章:

  • 2021-04-29
  • 2021-10-23
  • 2021-09-08
  • 2021-05-27
猜你喜欢
  • 2022-02-09
  • 2021-12-27
  • 2021-09-23
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案