引入支持

<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. python——ADSL拨号程序

    这是一个简单的测试实例 说说应用场景吧,都是因为电信搞的奇葩网络结构. 宿舍有若干层,每一层楼的网络拓扑如上图所示,本来是没有问题的,一个楼层接近四十个用户,都拥有一个电信给的宽带拨号账号.但是问题是 ...

  2. vim中代码自动格式化

    参考资料: https://blog.csdn.net/qachenzude/article/details/25511875 1,gg 跳转到第一行 2,shift+v 转到可视模式 3,shift ...

  3. [linux]Linux如何查看文件中的中间部分内容

    最基本的是cat.more和less. 1. 如果你只想看文件的前5行,可以使用head命令,如: head -5 /etc/passwd 2. 如果你想查看文件的后10行,可以使用tail命令,如: ...

  4. muduo 的windows下的编译

    四处寻觅开源代码学习,适合的代码非常稀少,不适合的原因却千奇百怪. 不是使用语言特性过于老旧(c++03) 就是使用的冷僻语法(template<T> enable_share_from_ ...

  5. 利用PHPExcel读取excel文件

    $filePath = "7788.xls"; $PHPExcel = new PHPExcel(); $PHPReader = new PHPExcel_Reader_Excel ...

  6. 用php脚本比较MySQL两个数据库的结构差异

    define('DATABASE1', 'mysql://root:password@127.0.0.1/db1'); $dbi1 = new DbMysql; $dbi1->dbh = DAT ...

  7. Delegate,Action,Func,匿名方法,匿名委托,事件 (转载)

    Delegate,Action,Func,匿名方法,匿名委托,事件 (转载) 一.委托Delegate 一般的方法(Method)中,我们的参数总是string,int,DateTime...这些基本 ...

  8. Mercurial和Git的主要区别(zz)

    Mercurial和Git的主要区别 17 August 2008 1.Mercurial用Python开发,Git用C开发,相对来说,Git比较快,但是Mercurial的性能也不差 2.Mercu ...

  9. linux_关闭防火墙

    centos6版本 永久关闭 chkconfig iptables off 查看状态 chkconfig iptables --list 此时关闭开机重新启动 service iptables sto ...

  10. 使用Hadoop API 解压缩 HDFS文件

    接上篇:使用Hadoop API 压缩HDFS文件 压缩完了,当然需要解压缩了. 直接上代码: private static void getFile(String filePath) throws ...