2014-03-07 74 views
0

我正在使用Spring 3.2.6並嘗試使用該標記。問題是Eclipse似乎無法找到mvc命名空間。 這裏是我的XML:Eclipse無法解析Spring 3 mvc模式

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

我已經試過沒有版本「http://www.springframework.org/schema/mvc/spring-mvc.xsd」,它仍然無法正常工作。 Eclipse無法自動完成「mvc」。如果我試圖運行它,我會得到一個「cvc-complex-type.2.4.c:匹配的通配符是嚴格的,但是對於元素'mvc:annotation-driven'沒有聲明。」錯誤,我一直在尋找並沒有太大幫助。

aop和上下文前綴可以完成,我的classpath中有spring-webmvc-3.2.6.jar。 任何幫助將非常感激。格雷特斯,亞歷克斯

+0

我建議你檢查一下你是否支持一些防止eclipse檢查遠程xsd資源的公司防火牆 –

+0

不,那不是。我可以看到窗口>首選項>網絡連接>緩存中列出的模式。 – Alexx

回答

2

我想你的xsi:schemaLocation mvc有問題。

變化http://www.springframework.org/schema/mvc/spring-mvc

http://www.springframework.org/schema/mvc

+0

謝謝,它的工作原理。我以前真的應該看到它。我想我有隧道視野。有時候,獨自呆一會兒會更好。 – Alexx

+0

不客氣。接受答案,如果它的工作,以便它會幫助其他人輕鬆地找到正確的答案..... :) –

0

試試這個:

<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:aop="http://www.springframework.org/schema/aop" 
     xmlns:mvc="http://www.springframework.org/schema/mvc" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd 
http://www.springframework.org/schema/aop 
      http://www.springframework.org/schema/aop/spring-aop.xsd 
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> 
0
<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:p="http://www.springframework.org/schema/p" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd 
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> 

這是我目前在我的應用程序嘗試使用這...