1、引入模板thymeleaf

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

增加配置

spring:
thymeleaf:
prefix: classpath:/templates/

  

2、增加接口

    @RequestMapping("/hello")
public String helloHtml(HashMap<String, Object> map) {
map.put("hello", "hello world~");
return "/index";
}

  

3、创建Html页面 index.html 路径为:resources/templates/index.html

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<title>Title</title>
</head>
<body>
<p th:text="${hello}"></p>
</body>
</html>

  

4、查看效果

 

最新文章

  1. 不能在DropDownList 中选择多个项
  2. HTML+CSS--继续学习
  3. tomcat 性能优化
  4. Azure 删除VHD时报错:There is currently a lease on the blob and no lease ID was specified in the request
  5. iOS中发送HTTP请求的方案
  6. PIT,BL,AP,CP,CSC
  7. 团队开发之《极速蜗牛》NABC分析
  8. 关于面向对象--oop
  9. hdu 4335 What is N?
  10. 查看ssh服务开启状态
  11. uva 10036 Problem C: Divisibility
  12. Golang网络库中socket阻塞调度源码剖析
  13. Java反射机制小例子
  14. VMware运行gazebo,关于vmw_ioctl_command error Invalid argument错误
  15. 正向代理or反向代理
  16. 解决微信小程序的wx-charts插件tab切换时的显示会出现位置移动问题-tab切换时,图表显示错乱-实现滑动tab
  17. HTML5-CSS3-JavaScript(3)
  18. QQ分享-定制分享卡片
  19. Android实现圆形的图片边角
  20. 如何读取jar包外的properties文件和log4j.properties

热门文章

  1. Java深入学习(2):并发队列
  2. Java垃圾回收_过程观察
  3. mybatis 批量添加数据的两种实现方式
  4. 2019年杭电多校第一场 1009题String(HDU6586+模拟+单调栈)
  5. jmeter多个接口测试
  6. BZOJ-1042:硬币购物(背包+容斥)
  7. 31、Python程序中的协程操作(greenlet\gevent模块)
  8. 【大数据】HBase启动
  9. Markdown插入图表
  10. swift的类型系统