SpringMVC @RequestBody接收json字符串,自动将日期字符串转换为java.util.Date

1.配置springMVC可以接收json字符串

[html]  view plain  copy
  1. xml version="1.0" encoding="UTF-8"?>  
  2. <beans  
  3.     xmlns="http://www.springframework.org/schema/beans"  
  4.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  5.     xmlns:p="http://www.springframework.org/schema/p"  
  6.     xmlns:context="http://www.springframework.org/schema/context"  
  7.     xmlns:aop="http://www.springframework.org/schema/aop"  
  8.     xmlns:tx="http://www.springframework.org/schema/tx"  
  9.     xmlns:mvc="http://www.springframework.org/schema/mvc"  
  10.     xsi:schemaLocation="http://www.springframework.org/schema/beans   
  11.     http://www.springframework.org/schema/beans/spring-beans-3.1.xsd  
  12.     http://www.springframework.org/schema/context  
  13.     http://www.springframework.org/schema/context/spring-context-3.1.xsd  
  14.     http://www.springframework.org/schema/tx  
  15.     http://www.springframework.org/schema/tx/spring-tx-3.1.xsd  
  16.     http://www.springframework.org/schema/aop  
  17.     http://www.springframework.org/schema/aop/spring-aop-3.1.xsd  
  18.     http://www.springframework.org/schema/mvc  
  19.     http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">  
  20.       
  21.     <bean   
  22.         class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">  
  23.         <property name="messageConverters">  
  24.             <list>  
  25.                   
  26.     <context:component-scan base-package="com.mvc.action">context:component-scan>  
  27.     <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"  
  28.         p:viewClass="org.springframework.web.servlet.view.JstlView"  
  29.         p:prefix="/"  
  30.         p:suffix=".jsp">  
  31.     bean>  
  32.       
  33.     

你可能感兴趣的:(JAVA,SpringMVC)