java - cvc-complex-type.2.4.c : The matching wildc

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

这是我的 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"

但你在这里没有提到它:

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

还有,比如

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 而不是名称中包含 -3.0 的那些。

关于java - cvc-complex-type.2.4.c : The matching wildcard is strict, 但找不到元素 'mvc:annotation-driven' 错误的声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19218122/

相关文章:

java - Spring 3中@Component和@Configuration的区别

java - Spring jsp页面未评估

java - 我应该把我的 ThreadLocals 放在一个 Spring 注入(inject)的

java - 关于 Spring web.xml

java - 依赖注入(inject) servlet 监听器

java - Spring 集成 - 入站与出站 channel 适配器

json - Spring 3.2RC1 中来自 JodaTime 的 jackson2 JSON

java - 多语言数据库,默认回退

java - 非法状态异常 : Cannot find changelog location: cl

spring - 将 HTML5 占位符属性添加到 Spring 3.0 表单输入元素