spring 配置thymeleaf
来源:互联网 发布:火四川方言版网络原唱 编辑:程序博客网 时间:2024/06/06 08:24
maven 中加入两下配置
<thymeleaf.version>3.0.5.RELEASE </thymeleaf.version>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>${thymeleaf.version}</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring4</artifactId>
<version>${thymeleaf.version}</version>
</dependency>
spring-serlvet.xml加入
<!-- 使用thymeleaf解析 -->
<bean id="templateResolver"
class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
<property name="prefix" value="/html/"/> //webapp目录下的html文件夹
<property name="suffix" value=".html"/>
<property name="templateMode" value="HTML"/>
<property name="cacheable" value="false"/>
</bean>
<bean id="templateEngine"
class="org.thymeleaf.spring4.SpringTemplateEngine">
<property name="templateResolver" ref="templateResolver"/>
</bean>
<bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
<property name="templateEngine" ref="templateEngine"/>
</bean>
@RequestMapping("/")
public String newspaper_html(Map map, HttpServletRequest request) {
map.put("name","jack");
return "index";
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.thymeleaf.org ">
<head>
<title></title>
</head>
<body>
hello world
<p th:text="${name}">666</p>
</body>
</html>
- spring mvc 配置 thymeleaf
- spring 配置thymeleaf
- Spring MVC + thymeleaf 非配置
- 在Spring中配置Thymeleaf的方法
- Spring Boot模板thymeleaf的基本配置
- spring+thymeleaf
- 电影网站增删改查-3 spring boots/MVC/neo4j/thymeleaf 源码分析 thymeleaf 配置
- 详解注解配置整合Spring MVC+Thymeleaf整合实例
- Spring Boot学习笔记-Thymeleaf模板引擎的配置
- Spring 配置Thymeleaf时出现ServletContextTemplateResolver no Matching constructor.....
- spring boot中配置共用Thymeleaf和Jsp
- spring boot使用thymeleaf模板配置和freem
- (五)Spring Boot配置静态资源访问,整合Thymeleaf模板
- spring-boot配置html模板引擎freemarker、thymeleaf
- spring mvc 整合 thymeleaf 使用java配置实现
- Spring MVC Thymeleaf
- thymeleaf与spring整合
- spring thymeleaf 中文乱码
- 棋盘覆盖问题
- Spring在tomcat下使用JTA事务
- 开源项目url
- python读写excel
- 未来几十年我们将看到人工智能(AI)翻天覆地的革命
- spring 配置thymeleaf
- 000045:在嵌套的循环中使用break跳出内层循环
- 冒泡排序
- 如何在阿里云服务器部署Redis第一篇--redis的安装
- 你同学都身价上亿了,你还在纠结早晨几点能起床
- android 微信第三方登录
- cpp——类——内存布局
- TensorFlow学习之路(1): correct = tf.nn.in_top_k(logits, labels, k)
- HTML:DOM操作