首页 > Web开发 > 详细

The prefix "mvc" for element "mvc:annotation-driven" is not bound 异常

时间:2017-09-16 14:33:18      阅读:439      评论:0      收藏:0      [点我收藏+]

使用STS或者eclipse 开发SpringMVC应用 时,我靠。。有个小小的东西没注意搞了半天,

STS在创建SpringMVC工程时,自动生成了Dispatcher的配置文件,然后看教程时,使用了<mvc:annotation-driven> 注解配置

但是自动生成的xml里呢有一个<annotation-driven>, 挺疑惑的,以为mvc约束文件版本不对,所以配置了很久的本地约束,仍然没有用

后来决定仔细看看什么问题,通过代码排版对齐,发现了。。。。。靠,前缀也是需要配置的!!改成下面所示代码。OK了

 

注意蓝色的是以前的,改成红色的,就多了个  :mvc

 

The prefix "mvc" for element "mvc:annotation-driven" is not bound异常

<?xml version="1.0" encoding="UTF-8"?>

<beans:beans

    xmlns= "http://www.springframework.org/schema/mvc"

    xmlns:mvc="http://www.springframework.org/schema/mvc"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns:beans="http://www.springframework.org/schema/beans"

    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">

   

    <mvc:annotation-driven />

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

       

</beans:beans>

 

The prefix "mvc" for element "mvc:annotation-driven" is not bound 异常

原文:http://www.cnblogs.com/maodot/p/7531042.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!