【问题标题】:Spring 3.0.3 SAXParseException with mvc:resourcesSpring 3.0.3 SAXParseException 与 mvc:resources
【发布时间】:2012-11-21 10:50:29
【问题描述】:

我的问题与one 非常相似。不过,我找不到错误:-(

这是我的 myapp-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:p="http://www.springframework.org/schema/p"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-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="de.myapp.controller" />

    <mvc:resources mapping="/resources/**" location="/resources/" />

    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass"
            value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/WEB-INF/views/" />
        <property name="suffix" value=".jsp" />
    </bean>

</beans>

我已经检查了几次xml,甚至this问题中提到的答案。我仍然得到Line 15 in XML document from ServletContext resource [/WEB-INF/myapp-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:resources'.

【问题讨论】:

    标签: xml spring-mvc


    【解决方案1】:

    只需使用 > 3.0.3 的版本,因为此功能从 3.0.4 版本开始可用!我用 3.2 版尝试了我的问题中引用的解释。而且效果很好!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-15
      • 1970-01-01
      • 2021-10-26
      • 1970-01-01
      • 1970-01-01
      • 2015-03-19
      • 2014-07-31
      • 1970-01-01
      相关资源
      最近更新 更多