<bean id="viewResolver" class="org.thymeleaf.spring5.view.ThymeleafViewResolver">
<!-- 视图优先级-->
<property name="order" value="1"/>
<!-- 解析视图解析器的编码-->
<property name="characterEncoding" value="UTF-8"/>
<!-- 模板-->
<property name="templateEngine">
<bean class="org.thymeleaf.spring5.SpringTemplateEngine">
<property name="templateResolver">
<bean class="org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver">
<!-- 视图前缀-->
<property name="prefix" value="/WEB-INF/templates/"/>
<!-- 视图后缀-->
<property name="suffix" value=".html"/>
<!-- 模板模型HTML5-->
<property name="templateMode" value="HTML5"/>
<!-- 页面编码-->
<property name="characterEncoding" value="UTF-8"/>
</bean>
</property>
</bean>
</property>
</bean>
Thymeleaf的视图解析器配置
最新推荐文章于 2024-02-07 14:22:55 发布