The prefix “mvc” for element “mvc:annotation-driven” is not bound Error

When using STS or eclipse to develop SpringMVC applications, I rely on it. . There is a little thing that I didn’t pay attention to for a long time

When STS created the SpringMVC project, it automatically generated the Dispatcher configuration file, and then when watching the tutorial, it used the <mvc:annotation-driven> annotation configuration

But there is an <annotation-driven> in the automatically generated xml, which is quite confusing, thinking that the version of the mvc constraint file is wrong, so the local constraints that have been configured for a long time are still useless.

Later, I decided to take a closer look at the problem and found it through code layout and alignment. . . . . Damn, the prefix also needs to be configured! ! Change to the code shown below. Ok

 

Note that the blue one is the previous one, change it to red, there will be one more: mvc

 

The prefix “mvc” for element “ mvc: annotation-driven” is not bound abnormal

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

 

Similar Posts: