小编Eug*_*hov的帖子

Spring v3没有为元素'mvc:resources'找到声明

目前正在运行

Tomcat:v6

Spring Tools Suite:v2.7.2

Spring框架:spring-webmvc-3.0.5

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: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/spring-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">

      <mvc:annotation-driven />

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

      <context:component-scan base-package="com.app.mvc" />

 </beans>
Run Code Online (Sandbox Code Playgroud)

web.xml部分代码

<servlet-mapping>
    <servlet-name>duckapp</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)

Servlet目的

web.xml将所有URL映射到servlet,但mvc:resources映射静态文件除外.

错误

  • cvc-complex-type.2.4.c:匹配的通配符是strict,但是没有找到元素'mvc:annotation-driven'的声明.app-servlet.xml/app/www/WEB-INF

  • cvc-complex-type.2.4.c:匹配的通配符是strict,但是没有为元素'mvc:resources'找到声明.app-servlet.xml/app/www/WEB-INF

已知的问题

如何修复编译错误以使mvc:资源正常工作?

我一直在挖掘大约2个小时,还没有可靠的答案......

java xml schema spring servlets

26
推荐指数
2
解决办法
5万
查看次数

Java虚拟机如何处理I/O操作?

我正在查看Java字节码指令列表,我注意到没有任何I/O指令.这引起了我的兴趣.JVM如何执行System.out.println不支持I/O指令的方法?

如果它使用某种形式的内存映射I/O,那么它如何与OS通信以读取文件描述符等?JVM是否实现了自己的抽象层来处理I/O操作?Java I/O包(java.io和java.nio)是用C/C++实现的吗?

java io jvm

4
推荐指数
1
解决办法
973
查看次数

标签 统计

java ×2

io ×1

jvm ×1

schema ×1

servlets ×1

spring ×1

xml ×1