1、引入thymeleaf依赖

 <!--thymeleaf-->
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

2、在application.yml进行thymeleaf配置

# 配置页面地址
spring:
  thymeleaf:
  prefix: classpath:/templates/

3、编写Controller

// 服务启动自动跳转首页
@RequestMapping(value = {"/","index"})
public String index(){
  return "index";
}

文件结构:

访问localhost:8080   或者 localhost:8080/index

SpringBoot 结合 Thymeleaf 进行页面的跳转的更多相关文章

  1. SpringBoot thymeleaf模板页面没提示,SpringBoot thymeleaf模板插件安装

    SpringBoot thymeleaf模板插件安装 SpringBoot thymeleaf模板Html页面没提示 SpringBoot  thymeleaf模板页面没提示 SpringBoot t ...

  2. Springboot+MyBatis+mysql+jsp页面跳转详细示例

           SpringBoot与MyBatis搭建环境,底层数据库为mysql,页面使用JSP(官网上不推荐使用jsp),完成从数据库中查询出数据,在jsp页面中显示,并且实现页面的跳转功能. 项 ...

  3. 【SpringBoot】转载 springboot使用thymeleaf完成数据的页面展示

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/weixin_36380516/artic ...

  4. springboot整合html时的页面的跳转404

    在用springboot对html的页面进行渲染时,页面找不到报404(type=Not Found, status=404)., 解决办法:是在ctroller层加相应的           @Re ...

  5. 【原】无脑操作:IDEA + maven + Shiro + SpringBoot + JPA + Thymeleaf实现基础授权权限

    上一篇<[原]无脑操作:IDEA + maven + Shiro + SpringBoot + JPA + Thymeleaf实现基础认证权限>介绍了实现Shiro的基础认证.本篇谈谈实现 ...

  6. 【原】无脑操作:IDEA + maven + Shiro + SpringBoot + JPA + Thymeleaf实现基础认证权限

    开发环境搭建参见<[原]无脑操作:IDEA + maven + SpringBoot + JPA + Thymeleaf实现CRUD及分页> 需求: ① 除了登录页面,在地址栏直接访问其他 ...

  7. springboot整合Thymeleaf模板引擎

    引入依赖 需要引入Spring Boot的Thymeleaf启动器依赖. <dependency> <groupId>org.springframework.boot</ ...

  8. Springboot整合thymeleaf模板

    Thymeleaf是个XML/XHTML/HTML5模板引擎,可以用于Web与非Web应用. Thymeleaf的主要目标在于提供一种可被浏览器正确显示的.格式良好的模板创建方式,因此也可以用作静态建 ...

  9. 3.SpringBoot整合Thymeleaf模板

    一.前言 SrpingBoot支持如JSP.Thymeleaf.FreeMarker.Mustache.Velocity等各种模板引擎,同时还为开发者提供了自定义模板扩展的支持. 使用嵌入式Servl ...

随机推荐

  1. [转]GLTF-3D图形界的JPEG

    GLTF简介 1.glTF(GL TransmissionFormat),即图形语言交换格式,它是一种3D内容的格式标准,由Khronos Group管理(Khronos Group还管理着OpenG ...

  2. 最快的方式清除Chrome浏览器DNS缓存

    最快的方式就是直接数据url,然后清除不须要的dns缓存. chrome://net-internals/#dns 一般步骤.要经过下列几项. Chrome - > 扳手 - > 选项 - ...

  3. dns-sd._udp.<domain>. 域名发现 本质和MDNS同

    DNS Service Discovery is a way of using standard DNS programming interfaces, servers, and packet for ...

  4. nyoj--1233--差值(贪心模拟+大数)

    差值 时间限制:3000 ms  |  内存限制:65535 KB 难度:3 描述 输入一个整数数组,将它们连接起来排成一个数,找出能排出的所有数字中最大,最小的两个,输出两个数的差值.例如输入数组{ ...

  5. P 值(p value)与统计检验

    P 值是最常用的一个统计学指标,几乎统计软件输出结果都有P值. 统计学的观点,超过一定基准(比如 5%,其实是低于5%),就不能简单地认为这是偶然事件了,而是受到了外在的影响. 一般而言,为了确定从样 ...

  6. 使用 Spring HATEOAS 开发 REST 服务--转

    原文地址:https://www.ibm.com/developerworks/cn/java/j-lo-SpringHATEOAS/index.html?ca=drs-&utm_source ...

  7. VS Code(Visual Studio Code)

    这次推荐 VS Code,这是个跨平台.免费的代码编辑器,集成开发.调试.编译为一身.单成启动速度,资源占用,就已经赢了各大编辑器(什么 SB.N++之类).以前觉得 VS 2015 是宇宙最强编辑器 ...

  8. 求从第一列走到第n列的最短路径

    11 14 23 12 18 21 13 10 28 15 29 17 无 无 25 如上表所示.求从第一列到第n列的最短路径,行数不定,列数不定.这种情况下用什么算法比较好 可能说的不大清楚,例如有 ...

  9. win10安装jdk8 配置环境变量

    参考:https://jingyan.baidu.com/article/6b97984dd257b41ca2b0bf86.html  

  10. VS2012恢复默认设置的2种方法

    方法一: 工具 → 导入和导出设置 → 重置所有设置 → 下一步 → 选择“是否保存当前设置”,下一步 → 选择“要重置的开发语言(如,Visual C# 开发设置)” → 完成. 方法二: 1.依次 ...