zoukankan      html  css  js  c++  java
  • The prefix "mvc" for element "mvc:annotationdriven" is not bound 异常

    使用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>

     

  • 相关阅读:
    第二周总结
    第一次结组作业概述
    Spring_Bean的自动装配
    Spring_依赖注入
    Spring_配置
    第一周总结
    1680. Concatenation of Consecutive Binary Numbers
    1631. Path With Minimum Effort
    1657. Determine if Two Strings Are Close
    1673. Find the Most Competitive Subsequence
  • 原文地址:https://www.cnblogs.com/maodot/p/7531042.html
Copyright © 2011-2022 走看看