0

您好,我的构建路径中有以下 jars -

spring-beans-3.1.2.RELEASE.jar
spring-context-3.1.2.RELEASE.jar
spring-core-3.1.2.RELEASE.jar
spring-expression-3.1.2.RELEASE.jar
spring-web-3.1。 2.RELEASE.jar
spring-webmvc-3.1.2.RELEASE.jar
thymeleaf-spring3-2.0.13.jar

和我的 servlet

<?xml version="1.0" encoding="UTF-8"?><br>
<beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:context="http://www.springframework.org/schema/context"
     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.1.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">

    <context:component-scan base-package="web.controller" />

    <!-- Enabling Spring MVC configuration through annotations -->
    <mvc:annotation-driven />

    <!--  Mapping Static Resources -->
    <mvc:resources mapping="/resources/**" location="/resources/" />

    <bean id="templateResolver" class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
        <property name="prefix" value="/WEB-INF/views/" />
        <property name="suffix" value=".html" />
        <property name="templateMode" value="HTML5" />
    </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="order" value="1" />
        <property name="viewNames" value="*.html" />
    </bean>

</beans>

我在启动时遇到的错误是 -

找不到在 ServletContext 资源 [/WEB-INF/springMVC-servlet.xml] 中定义的名称为“templateResolver”的 bean 的类 [org.thymeleaf.templateresolver.ServletContextTemplateResolver];嵌套异常是 java.lang.ClassNotFoundException: org.thymeleaf.templateresolver.ServletContextTemplateResolver 我在这里缺少任何其他库吗?任何帮助深表感谢。

4

1 回答 1

4

您缺少实际的 Thymeleaf 罐子。您包含了提供集成的 Spring jar,但您错过了它的实际实现。

从这里下载 jar

百里香下载网站

于 2012-10-27T21:31:43.327 回答