在springMVC中我們經常會用到<mvc:resources/>標簽,但是有些編輯器中的schema過於陳舊。導致找不到<mvc:resources/>標簽。
經過試驗,有兩個解決辦法:
1.替換文件:
打開window->preferences,在輸入框輸入xml找到xml Catalog。在右邊中找到http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
這一項並單擊,看下面的Details,找到文件路徑和key。
key:http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
那么我們打開網址:http://www.springframework.org/schema/mvc並下載spring-mvc-3.0.xsd文件。
再打開文件路徑:Location: D:\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\1077\1\.cp\org\springframework\web\servlet\config\spring-mvc-3.0.xsd
找到文件:D:\MyEclipse-8.6\configuration\org.eclipse.osgi\bundles\1077\1\.cp\org\springframework\web\servlet\config下面。
用下載的文件進行替換即可。最后重啟myeclipse即可。
2.第二個方法:
在spring的配置文件中會有這樣的代碼:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
將其中http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">改為
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">即可。