`

myeclipse validation 验证spring mvc:resource报错解决方案

阅读更多

   在配置spring - mvc 的时候,有针对resource资源的配置

 

 

    <!-- http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-static-resources -->
    <mvc:resources mapping="/static/**" location="/static/"  />

 

   该配置的xml命名空间为:

 

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:util="http://www.springframework.org/schema/util"
	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/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
 		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

 

   但是eclipse 在   <mvc:resources mapping="/static/**" location="/static/" /> 这行中总是报错,提示:

 

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for 
 element 'mvc:resources'.

 

 

   问题小,但是工程有个错误提示总是不爽,具体解决如下:

 

 

 

   1. 打开 windows -> preference , 弹出对话框

   2. 在该dialog中左上角的 "type filter text" 中,输入 "xml c"关键字,会跳到"XML Catalog"目录。

   3. 在 XML Catalog Entries中找到 "Plugin Specified Entries" 。

   4. 拖动滚动条到下方,找到 "http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd" 项

   5. 点击该项,在下面的 "Details" 会有相关详情:类似

        Location: /**/Genuitec/MyEclipse-8.6/configuration/org.eclipse.osgi/bundles/1070/1/.cp/org/springframework/web/servlet/config/spring-mvc-3.0.xsd

        URI:         file:/**/Genuitec/MyEclipse-8.6/configuration/org.eclipse.osgi/bundles/1070/1/.cp/org/springframework/web/servlet/config/spring-mvc-3.0.xsd

        Key Type: Namespace Name

        Key:         http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd

    6. 访问"http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd",下载该文件,替换 Location 对应的文件(保险起见,建议备份该文件)

    7. 重新build 工程,错误提示就被哈皮的去掉了~~

 

 

 

 

分享到:
评论
2 楼 gogomarine 2011-02-23  
AnnBaby 写道
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd

下载替换MyEclipse里面的就可以了


不知道为什么我的帖子样式会变成这样。
我的文章就是描述怎么找到该mvc.xsd文件
1 楼 AnnBaby 2011-02-22  
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd

下载替换MyEclipse里面的就可以了

相关推荐

Global site tag (gtag.js) - Google Analytics