zoukankan      html  css  js  c++  java
  • 对象转换为json格式,类似中间层API

    《一头扎进SpringMvc视频教程《一头扎进SpringMvc》第四讲 源码》

    对象自动转换为json格式要在 spring-mvc.xml添加一个东西 ,和对应的命名空间引用和规范,和对应的jar包

    <!-- 支持对象与json的转换。 -->
    <mvc:annotation-driven/>  //注解驱动

    提到目前已经引用了一堆很乱的jar包,maven时就简单了。

    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:p="http://www.springframework.org/schema/p"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/mvc
            http://www.springframework.org/schema/mvc/spring-mvc.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context.xsd">
    
    
    <!-- 支持对象与json的转换。 -->
        <mvc:annotation-driven/>  

    对应的jar包

    jackson-annotations-2.2.1.jar
    jackson-core-2.2.1.jar
    jackson-core-asl-1.8.8.jar
    jackson-databind-2.2.1.jar
    jackson-mapper-asl-1.8.8.jar
    jackson-module-jaxb-annotations-2.2.1.jar

  • 相关阅读:
    es6 可迭代对象
    前端模板
    快速排序
    parseHTML2Vnode
    最大并发请求
    选择排序
    window命令
    Asp.net问题集锦
    ExtJs5.1.1使用中问题集锦
    Sql Server问题集锦
  • 原文地址:https://www.cnblogs.com/rogge7/p/7050480.html
Copyright © 2011-2022 走看看