我知道在很多问题中都会问过这个问题。我正在发布,因为我尝试了所有选项并仍然收到错误。
<?xml version="1.0" encoding="UTF-8"?>
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 http://www.springframework.org/schema/mvc/spring-mvc.xsd“&GT;
<mvc:annotation-driven></mvc:annotation-driven>
<context:component-scan base-package="com.cts"></context:component-scan>
<mvc:bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp" />
<property name="suffix" value=".jsp" />
</mvc:bean>
<mvc:bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
</mvc:bean>
<bean id="validator"
class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"></bean>
<mvc:interceptors>
<bean class="org.springframework.web.,servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="locale"></property>
</bean>
</mvc:interceptors>
我正在接受
描述资源路径位置类型 cvc-complex-type.2.4.c:匹配的通配符是strict,但是没有为元素'mvc:bean'找到声明。 spring-servlet.xml / CATestSlotBooking_Skeleton / WebContent / WEB-INF第17行XML问题
我正在使用Spring 4.01发布jar
答案 0 :(得分:1)
看起来缺少架构。
更新XML标头,如下所示。
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
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
答案 1 :(得分:0)
InternalResourceViewResolver
&amp;您的xml中错误地定义了messageSource
。没有mvc:bean
这样的标记。这就是问题的原因。应该如下。
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
</bean>
答案 2 :(得分:0)
您可以使用此spring-servlet.xml文件
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package="com.cts"></context:component-scan>
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
</bean>
<bean id="validator"
class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"></bean>
<mvc:interceptors>
<bean class="org.springframework.web.,servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="locale"></property>
</bean>
</mvc:interceptors>
<mvc:annotation-driven />
</beans>