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. 从fork面试题開始的思考

    一.文章来由 还是按照惯例来说一下文章为什么来的.晚上好基友在网上刷面试题,看到一个有趣的题目,于是開始了研究,就有了这篇文章. 二.进入正题 题目例如以下: #include <stdio.h ...

  2. 【Struts2学习笔记(12)】Struts2国际化

    (1)准备资源文件,资源文件的命名格式例如以下: baseName_language_country.properties baseName_language.properties baseName. ...

  3. 深入理解cookie与session

    cookie和session是web开发比較基础也比較重要的知识,cookie和session用于用户的状态管理.简单的来说它们都仅仅是http中的一个配置项,在Servlet规范中也仅仅相应一个类而 ...

  4. 通过DNS通道传输的交互式PowerShell脚本

    摘自:http://www.freebuf.com/sectool/90616.html 欢迎来到一周PowerShell脚本的第五天,今天我们将讨论使用ICMP和DNS的交互式PowerShell脚 ...

  5. MailKit和MimeKit的.NET基础邮件服务

    MailKit和MimeKit的.NET基础邮件服务 邮件服务是一般的系统都会拥有和需要的功能,但是对于.NET项目来说,邮件服务的创建和使用会较为的麻烦..NET对于邮件功能提供了System.Ne ...

  6. 关于node的聊天室错误

    Deprecationwarning:process,EventEmitter is deprecated use require ('events')instead 关于node的聊天室错误 > ...

  7. vue1.0父子、兄弟间 通信案例

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. webpack的理解

    webpack是一个模块打包工具,你可以使用webpack管理你的模块依赖,并编译输出模块们所需要的静态文件.它能够很好的管理.打包Web开发中所用到的HTML.Javascript.CSS以及各种静 ...

  9. NodeJS学习笔记 (28)流操作-stream(ok)

    模块概览 nodejs的核心模块,基本上都是stream的的实例,比如process.stdout.http.clientRequest. 对于大部分的nodejs开发者来说,平常并不会直接用到str ...

  10. Laravel API 允许跨域访问

    服务器A请求服务器B的接口,那么一般会出现跨域问题.全解跨域请求处理办法 XMLHttpRequest cannot load http://api.console.vms3.com/api/user ...