立即学习:https://edu.csdn.net/course/play/25330/298891?utm_source=blogtoedu
动态资源:JSP(Springboot默认不支持)
推荐:模板引擎thymeleaf
网页=模板+数据
引入thymeleaf:到官网查询thymeleaf的依赖(Maven)
使用thymeleaf:代码在哪里写?
ThymeleafAutoCongifutation
XxProperties
通过ThymeleafProperties源码得知:
使用thymeleaf只需要将文件放入目录:
"classpath:/templates/" ;文件的后缀:".html":
注意:在传统的web项目中:静态资源修改后是不需要重启的;但是在SpringBoot项目中,修改后需要重启
<p th:text="${welcome}">welcome to thymeleaf......</p>以上
先从${welcome}中取值,没有的话再取html标签里的value
th:就是表示替换原有的HTML值:th:html属性名=值
其他用法:
th:xx (参考官方文档第十章 Attribute Pre...)
th:text 获取文本值,不会解析html
th:utext 会解析html,在页面中显示相应的样式
d
符号:
除了$还有*{...} #{...}等等。查看第四章Standard Express....