Spring 3拦截器错误:类型元素类型“beans”必须后跟属性规范,“>”或“/>”

时间:2014-04-10 18:38:02

标签: java xml spring spring-mvc web-applications

我是Spring 3 MVC的新手,并尝试通过关注此URL作为参考来实现Interceptors

http://viralpatel.net/blogs/spring-mvc-interceptor-example/

我在spring-servlet.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:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc 
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-3.0.xsd"> 
<context:annotation-config />
<context:component-scan
    base-package="com.spring.controller" />

<mvc:interceptors>
  <bean class="com.spring.interceptor.HelloWorldInterceptor" />
</mvc:interceptors>    
     <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />

 

我在这一行中收到了这个错误:

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

请告诉我如何解决此问题。

2 个答案:

答案 0 :(得分:0)

以下主题已解决了该问题,因此也关闭了此主题。

Spring v3 no declaration can be found for element 'mvc:resources'

答案 1 :(得分:0)

请关闭您的bean定义

  <bean id="jspViewResolver" 
  class="org.springframework.web.servlet.view.InternalResourceViewResolver"/>