zoukankan      html  css  js  c++  java
  • springmvc: 普通list数据输出json

    springmvc: 普通list数据输出json

    加入json依赖

     <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>2.7.3</version>
            </dependency>
    
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>2.7.3</version>
            </dependency>
    
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>2.7.3</version>
            </dependency>
    

      

    spring-servlet.xml的bean配置

    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
    		<property name="messageConverters">
    			<list>
    				<ref bean="mappingJacksonHttpMessageConverter" />
    			</list>
    		</property>
    	</bean>
    	<bean id="mappingJacksonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
    		<property name="supportedMediaTypes">
    			<list>
    				<value>application/json;charset=UTF-8</value>
    			</list>
    		</property>
    	</bean>
    

      

  • 相关阅读:
    web前端防治重复提交
    layabox笔记
    fixfff
    laybax
    小游戏初始化,资源加载异常处理,黑屏处理
    微信小游戏资源加载页与云存储
    前端唠嗑
    css 的一些样式笔记
    小游戏虚拟手柄
    VUE最佳实践
  • 原文地址:https://www.cnblogs.com/achengmu/p/9970944.html
Copyright © 2011-2022 走看看