spring boot中使用thymeleaf
2020-12-13 04:20
阅读:558
YPE html>
标签:cti type charset org obj ref char 结果 localhost
目录
- 1.pom.xml引入thymeleaf
- 2.关闭缓存application.properties
- 3.编写Controller类
- 4.模板html
- 5.运行结果
1.pom.xml引入thymeleaf
org.springframework.boot
spring-boot-starter-thymeleaf
2.关闭缓存application.properties
spring.thymeleaf.cache=false
3.编写Controller类
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.Map;
@Controller
@RequestMapping("/home")
public class HomeController {
@RequestMapping(value = "/index")
public String index(Map map) {
map.put("userName","Bill Gates");
return "index";
}
}
4.模板html
/resources/templates/index.html
Title
hello,
5.运行结果
访问地址:http://localhost:8090/home/index
hello,Bill Gates
spring boot中使用thymeleaf
标签:cti type charset org obj ref char 结果 localhost
原文地址:https://www.cnblogs.com/bqh10086/p/11108266.html
评论
亲,登录后才可以留言!