Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/397.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring MVC没有';添加mvc命名空间时不起作用_Java_Spring_Spring Mvc - Fatal编程技术网

Java Spring MVC没有';添加mvc命名空间时不起作用

Java Spring MVC没有';添加mvc命名空间时不起作用,java,spring,spring-mvc,Java,Spring,Spring Mvc,我的MVC项目在没有MVC名称空间的情况下工作得非常好,但是当添加它时 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3

我的MVC项目在没有MVC名称空间的情况下工作得非常好,但是当添加它时

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    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-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
        ">

    <context:component-scan base-package="com.evgeni.msgdisp.controller" />

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

    <bean id="templateResolver"
        class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
        <property name="prefix" value="/WEB-INF/pages/" />
        <property name="suffix" value=".html" />
        <property name="templateMode" value="HTML5" />
        <property name="cacheable" value="false" />
    </bean>

    <bean id="templateEngine" class="org.thymeleaf.spring3.SpringTemplateEngine">
        <property name="templateResolver" ref="templateResolver" />
    </bean>

    <bean class="org.thymeleaf.spring3.view.ThymeleafViewResolver">
        <property name="templateEngine" ref="templateEngine" />
        <property name="characterEncoding" value="UTF-8" />
    </bean>

</beans>

我得到404,日志显示,[/node/manage]没有找到处理程序映射。jsp也是如此,所以不是Thimeleaf问题。 我很确定这是
xsd
版本的东西。我使用Spring3.2

通过添加

<mvc:annotation-driven/> 

显然,使用时会覆盖默认行为

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

感谢您对“注释”的评论

请小心使用注释驱动,两天前我的项目不能使用resources目录,因为我将Spring3.2.8与Hibernate4.2.6混合使用。他们使用他自己的注释集。 混合使用这两种技术,在servlet配置中使用两种注释标记:

<mvc:annotation-driven/> in controller and views configuration
<mvc:resources mapping=" ...
...

<tx:annotation-driven/> in transacional or hibernate configuration
控制器和视图配置中的