【发布时间】:2018-05-29 05:15:54
【问题描述】:
我做了以下设置来使用jsonView。
调度程序-serlvet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd">
<bean id="jsonView" class="net.sf.json.spring.web.servlet.view.JsonView">
<property name="contentType" value="application/json;charset=UTF-8" />
</bean>
</beans>
pom.xml:
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
但是dispatcher-sevlet.xml中出现如下错误:
Multiple annotations found at this line:
- Class 'net.sf.json.spring.web.servlet.view.JsonView' not found
- Class 'net.sf.json.spring.web.servlet.view.JsonView' not found [config set: rachelivf/web-
context]
我不知道为什么会这样。初学者需要答案。请告诉我如何解决它。
【问题讨论】:
标签: json spring maven spring-mvc servlets