Подтвердить что ты не робот

Cvc-complex-type.2.4.c: Подстановочный шаблон является строгим, но объявления элемента "mvc: annotation-driven" не найдено.

Я добавил spring -security-config-3.1.0.RC3.jar в мою папку lib, и я все еще получаю эту ошибку. Какая может быть причина?

Вот мой диспетчер-servlet.xml

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:mvc="http://www.springframework.org/schema/mvc"
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans     
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/context 
   http://www.springframework.org/schema/context/spring-context-3.0.xsd">

   <context:component-scan base-package="com.tcs.rspm.controller" />
<mvc:annotation-driven /> 
   <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
      <property name="prefix" value="/webpages/" />
      <property name="suffix" value=".jsp" />
   </bean>

</beans>
4b9b3361

Ответ 1

У вас есть это:

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

но вы не упоминаете это здесь:

xsi:schemaLocation="
http://www.springframework.org/schema/beans     
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-3.0.xsd">

Чтобы это исправить, вы должны иметь

http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd

там также, как

xsi:schemaLocation="
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans     
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-3.0.xsd">

Примечание. Обычно в ссылках схемы не упоминается версия Spring, чтобы упростить обновление, поэтому вместо ссылок следует использовать ссылки, такие как http://www.springframework.org/schema/context/spring-context.xsd имеющий -3.0 в названии.