2014-03-07 46 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"> 

这是我目前在我的应用程序尝试使用这...