引入支持

<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring5</artifactId>
<version>3.0.9.RELEASE</version>
</dependency>

配置application.yml

spring:
thymeleaf:
cache: false
suffix: .html
#prefix: classpath:/templates/ 默认值

在resourse/templates/下建立index.html

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
welcome
</body>
</html>

控制器 LongController.java

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; @RequestMapping("login")
@Controller
public class LoginController {
@RequestMapping("login")
public String login(){
System.out.println("aaaa");
return "index";
} }

启动项目,浏览器访问 http://localhost:8080/login/login  

  

  

spring boot thymeleaf的更多相关文章

  1. spring boot + thymeleaf 3 国际化

    在给spring boot 1.5.6 + thymeleaf 3进行国际化时,踩了一个坑(其实不止一个). 现象: 看到了吧, 就是取值的key, 后面被加了_en_US 或 _zh_CN, 以及前 ...

  2. spring boot + Thymeleaf开发web项目

    "Spring boot非常适合Web应用程序开发.您可以轻松创建自包含的HTTP应用.web服务器采用嵌入式Tomcat,或者Jetty等.大多数情况下Web应用程序将使用 spring- ...

  3. Spring boot+Thymeleaf+easyui集成:js创建组件页面报错

    开发工具:Ideal 使用场景:Demo 前提:       环境:Spring boot +Thymeleaf+easyui 引入thymeleaf模板引擎 <html lang=" ...

  4. spring boot: thymeleaf模板引擎使用

    spring boot: thymeleaf模板引擎使用 在pom.xml加入thymeleaf模板依赖 <!-- 添加thymeleaf的依赖 --> <dependency> ...

  5. Spring Boot Thymeleaf 实现国际化

    开发传统Java WEB工程时,我们可以使用JSP页面模板语言,但是在SpringBoot中已经不推荐使用了.SpringBoot支持如下页面模板语言 Thymeleaf FreeMarker Vel ...

  6. spring boot + thymeleaf 乱码问题

    spring boot + thymeleaf 乱码问题 hellotrms 发布于 2017/01/17 15:27 阅读 1K+ 收藏 0 答案 1 开发四年只会写业务代码,分布式高并发都不会还做 ...

  7. spring boot thymeleaf 标签未关闭报错

    每天学习一点点 编程PDF电子书免费下载: http://www.shitanlife.com/code spring boot,input标签未关闭报bug,代码稍有不慎就出小问题,后来百度,goo ...

  8. Spring Boot + thymeleaf 后台与页面(二)

    Spring Boot推荐使用thymeleaf模板完成与页面的交互(已不支持JSP某些特性,不推荐JSP) 步骤 在一个Spring Boot Web项目基础上,也可以参考我前一篇文章建立的项目 1 ...

  9. Spring Boot + thymeleaf 实现文件上传下载

    参考博客:https://juejin.im/post/5a326dcaf265da431048685e 技术选型:spring boot 2.1.1+thymeleaf+maven 码云地址:htt ...

  10. Spring Boot Thymeleaf 使用详解

    在上篇文章Spring Boot (二):Web 综合开发中简单介绍了一下 Thymeleaf,这篇文章将更加全面详细的介绍 Thymeleaf 的使用.Thymeleaf 是新一代的模板引擎,在 S ...

随机推荐

  1. XiaoKL学Python(C)__future__

    __future__ in Python 1. from __future__ import xxxx 这是为了在低版本的python中使用可能在某个高版本python中成为语言标准的特性,从而 在将 ...

  2. UIImageView中的UIButton不响应事件解决方案

    如下: CGRect imageRect = (CGRect){, , , }; UIImageView *imageView = [[[UIImageView alloc] initWithFram ...

  3. 大牛的距离(笑cry)精简算法

    在一条数轴上有N头牛在不同的位置上,每头牛都计算到其它各头牛的距离.求这n*(n-1)个距离的总和.1<= N <= 10000.每头牛所在位置是一个范围在0到1,000,000,000之 ...

  4. BUG(0):用某位表示特定属性

    用某个bit表示特定属性通常有两种方式: 1.指定某个特定的value #define _PAGE_VALID 0x0001 0bit 为 1 时表示此时的page entry是有效的 用法如下,此时 ...

  5. mysql索引相关

    索引有主键索引.唯一索引.普通索引 单列索引,复合索引. 复合索引(a,b,c),可以理解是有三个索引,分别是a.b.c三个索引 前缀不是a的话,复合索引都不起作用,前缀用函数或者是范围,比如< ...

  6. 尝试解决nginx的499错误1

  7. 学习第一天-JAVA

    第一题打印1到1000的奇数 public class OneToThousandOdd{ public static void main(String[] args) { short num = 1 ...

  8. 回文日期(NOIP2016)

    题目:回文日期 这题虽然说不难,但是也不能算水了. 我先讲讲思路.60分的算法很好写,就是判断一下是不是回文串,分离每个数位,判断即可. 但我们的目标是满分,所以我来讲讲满分算法. 首先,给的是区间, ...

  9. CSS-尺寸与边框

    1.基础选择器的优先级 权值:标识当前选择器的重要程度,权值越大优先级越高. 元素选择器 1 类选择器 10 伪类选择器 10 ID选择器 100 内联样式 1000 选择器的权值加到一起,大的优先 ...

  10. IDEA如何把写好的java文件/项目打包成一个jar的文件

    一.命令行的方法 打开cmd,输入jar -cvf [打包后的文件名].jar [要打包的目录]. 二.IDEA的方法 写完一个java程序把它封装成一个jar的包  这样就可以在别的jar上面运行这 ...