spriingboot使用thymeleaf
1 添加jar包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
2 配置文件
server.port=8090
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.cache=false
spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**
3 在templates下新建hello.html
4 新建测试TestController.java
@Controller
public class TestController {
@RequestMapping("/hello")
public String toHello() {
return "hello";
}
}
5 访问页面
6 完成
spriingboot使用thymeleaf的更多相关文章
- spring boot(四):thymeleaf使用详解
在上篇文章springboot(二):web综合开发中简单介绍了一下thymeleaf,这篇文章将更加全面详细的介绍thymeleaf的使用.thymeleaf 是新一代的模板引擎,在spring4. ...
- Thymeleaf
1.在html顶部添加 <html xmlns:th="http://www.thymeleaf.org"> 2.url表达式 @{...} <link rel= ...
- Thymeleaf 模板的使用
Thymeleaf是现代化服务器端的Java模板引擎,不同与JSP和FreeMarker,Thymeleaf的语法更加接近HTML,并且也有不错的扩展性.详细资料可以浏览官网.本文主要介绍Thymel ...
- vert.x学习(三),Web开发之Thymeleaf模板的使用
在vert.x中使用Thymeleaf模板,需要引入vertx-web-templ-thymeleaf依赖.pom.xml文件如下 <?xml version="1.0" e ...
- 页面上使用 Thymeleaf 的内联js不当造成了 java.lang.StackOverflowError: null 问题
由于在页面上内联js使用不当,从而在从 Controller 跳转到页面时发生了以下错误: java.lang.StackOverflowError: null at org.thymeleaf.ut ...
- Thymeleaf 与 Javascript
在 javascript 代码中使用 Thymeleaf 模板引擎: <script th:inline="javascript"> $("#content& ...
- Thymeleaf+SpringMVC,如何从模板中获取数据
Thymeleaf+SpringMVC,如何从模板中获取数据 在一个典型的SpringMVC应用中,带@Controller注解的类负责准备数据模型Map的数据和选择一个视图进行渲染.这个模型Map对 ...
- Thymeleaf+Spring整合
前言 这个教程介绍了Thymeleaf与Spring框架的集成,特别是SpringMvc框架. 注意Thymeleaf支持同Spring框架的3.和4.版本的集成,但是这两个版本的支持是封装在thym ...
- thymeleaf常用标签
1. th:checked ,th:selected标签<input type="radio" value="M" name="gender&q ...
随机推荐
- redis启动警告解决
vim /etc/rc.localecho never > /sys/kernel/mm/transparent_hugepage/enabled加入上面那句到/etc/rc.local,开机启 ...
- 【Docker学习之四】Docker自定义容器镜像
环境 docker-ce-19.03.1-3.el7.x86_64 centos 7 一.使用已有容器创建镜像-docker commit1.查看本地已有镜像 [root@node105 ~]# do ...
- Hadoop入门——初识Hadoop
一.hadoop是什么 Hadoop被公认是一套行业大数据标准开源软件,在分布式环境下提供了海量数据的处理能力.几乎所有主流厂商都围绕Hadoop开发工具.开源软件.商业化工具和技术服务.今年大型IT ...
- 一段隐藏文字的css代码,记录下
<span style="width:1px; height:1px; color:#fff; outline-width:hidden; overflow:hidden; displ ...
- adb devices命令链接设备失败 解决办法
使用adb devices命令链接设备失败 1,检查adb的环境配置是否存在问题 参见我的博客(sdk配置):https://www.cnblogs.com/changpuyi/p/9459025.h ...
- P4Merge的使用
(官网: https://www.perforce.com/products/helix-core-apps/merge-diff-tool-p4merge 可以作为一个stand alone app ...
- git 删除本地分支,删除远程分支
本地分支 git branch -d 分支名 远程分支 git push origin --delete 分支名 查看所有分支 git branch -a
- 【转帖】为什么有了Compose和Swarm,还会有Kubernetes的出现?
为什么有了Compose和Swarm,还会有Kubernetes的出现? https://www.cnblogs.com/chenqionghe/p/11474486.html 图非常好 一.k8s设 ...
- jquery+css 点赞喜欢特效
百度盘链接 https://pan.baidu.com/s/1Nu8fiUrdffsNd6usTsUESg 密码 mps4 效果:
- JavaSE面试题:类初始化和实例初始化等
类初始化过程 1.一个类要创建实例需要先加载并初始化该类 main方法所在的类需要先加载和初始化 2.一个子类要初始化需要先初始化父类 3.一个类初始化就是执行<clinit>()方法 & ...