Spring MVC 配置文件'mvc:resources'中的错误



--配置文件--cvc复杂类型。2.1:元素"mvc:resources"必须没有字符或元素信息项[childred],因为该类型的内容类型为空

 <?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:context="http://www.springframework.org/schema/context"
     xmlns:mvc="http://www.springframework.org/schema/mvc"
     xsi:schemaLocation="http://www.springframework.org/schema/beans
     http://www.springframework.org/schema/beans/spring-beans-2.5.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.2.xsd">  
     <!-- Enable annotation driven controllers, validation etc... -->  
    <mvc:annotation-driven></mvc:annotation-driven>  
    <context:component-scan base-package="com.dhs.controller">  
    </context:component-scan>  
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" id="viewResolver">  
     <property name="prefix" value="/WEB-INF/views/"></property>  
     <property name="suffix" value=".jsp"></property>  
    </bean>  
    <mvc:resources location="/WEB-INF/staticContents/" mapping="/staticContents/**">  
    </mvc:resources>   
    </beans>  
<mvc:resources location="/WEB-INF/staticContents/" mapping="/staticContents/**">  
</mvc:resources> 

删除上面的行并将其写为

<mvc:resources location="/WEB-INF/staticContents/" mapping="/staticContents/**"/>

并且不会有标记的错误

dhs,

我认为你编辑了一些代码。

<!-- Handles HTTP GET requests for /resources/** by efficiently serving 
    up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />

您搜索到web应用程序文件夹结构。

如果可以升级,请升级到springmvc4,这在springmvc4。http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd

相关内容

最新更新