本文介绍了cvc-complex-type.2.4.c:匹配的通配符是strict,但是没有找到元素'mvc:annotation-driven'错误的声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的lib文件夹中添加了spring-security-config-3.1.0.RC3.jar,但仍然出现此错误。可能的原因是什么?

I have added the spring-security-config-3.1.0.RC3.jar in my lib folder and i still get this error. What can be possible reason ??

这是我的调度员-servlet.xml

Here is my dispatcher-servlet.xml

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:mvc="http://www.springframework.org/schema/mvc"
   xsi:schemaLocation="
   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:component-scan base-package="com.tcs.rspm.controller" />
<mvc:annotation-driven />
   <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
      <property name="prefix" value="/webpages/" />
      <property name="suffix" value=".jsp" />
   </bean>

</beans>


推荐答案

你有这个:

xmlns:mvc="http://www.springframework.org/schema/mvc"

但你在这里没有提到它:

but you're not mentioning it here:

xsi:schemaLocation="
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">

要解决此问题,您应该

http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd

还有,例如

there as well, like

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">

注意:架构引用实际上通常不提Spring版本以便于升级,所以你也可以使用像 http://www.springframework.org/schema/context/spring-context.xsd 这样的引用。

Note: it is actually common that schema references don't mention Spring version to allow for easier upgrading, so you could use references like http://www.springframework.org/schema/context/spring-context.xsd as well.

这篇关于cvc-complex-type.2.4.c:匹配的通配符是strict,但是没有找到元素'mvc:annotation-driven'错误的声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 07:05