1

私の質問はこれと非常によく似ています。それにもかかわらず、私は間違いを見つけることができません:-(

ここに私の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を数回チェックしました。私はまだ得る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'.

4

1 に答える 1

0

この機能はバージョン 3.0.4 以降で使用できるため、バージョン > 3.0.3 を使用してください。質問で参照されている説明をバージョン 3.2 で試しました。そしてそれは完全に機能します!

于 2012-11-21T12:36:54.410 に答える