我正在使用 SpringMVC,我的 jsp 页面没问题,但现在我尝试将我的应用程序与 Thymeleaf 集成。thymeleaf-servlet.xml<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" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" 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-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd "> <mvc:annotation-driven/> <context:annotation-config /> <context:component-scan base-package="com.application" /> <bean id="templateResolver" class="org.thymeleaf.templateresolver.ServletContextTemplateResolver"> <property name="prefix" value="/WEB-INF/thymeleaf/" /> <property name="suffix" value=".html" /> </bean> <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine"> <property name="templateResolver" ref="templateResolver" /> </bean> <bean id="viewResolver" class="org.thymeleaf.spring4.view.ThymeleafViewResolver"> <property name="templateEngine" ref="templateEngine" /> </bean> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basenames"> <!-- messages.properies --> <list><value>messages</value></list> </property> </bean>
1 回答
慕工程0101907
TA贡献1887条经验 获得超5个赞
如果您的 productService 在方法上有 @Transactional,我猜您忘记在 xml 中添加事务注释
<tx:annotation-driven />
请将上述元素添加到您的 xml
添加回答
举报
0/150
提交
取消