如题,在调试代码的时候遇到类似问题,解决办法:
1.web.xml
<!-- 配置Spring MVC的前端控制器:DispatchcerServlet --> <servlet> <servlet-name>SpringMVC</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:springmvc.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>SpringMVC</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
2.pom.xml加入jackson,jackson和fastjson各有所长看使用场景
进行解析
<!--<dependency><!–2.alibaba–>--> <!--<groupId>com.alibaba</groupId>--> <!--<artifactId>fastjson</artifactId>--> <!--<version>1.2.41</version>--> <!--</dependency>--> <!-- JSON: jackson --> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-asl</artifactId> <version>1.9.12</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-lgpl</artifactId> <version>1.9.12</version> </dependency>