SpringBoot公共组件的抽取

报错信息

020-02-01 22 [http-nio-8080-exec-1] ERROR org.thymeleaf.TemplateEngine - [THYMELEAF][http-nio-8080-exec-1] Exception processing template "main": An error happened during template parsing (template: "class path resource [templates/main.html]") org.thymelea

修改

1.注意公共组件放入templates下

2.

<div th:replace="common/leftbar :: bar"></div>

径一定要是 

common/leftbar :: bar

  不要在common前加 / 

因为你加了 / 之后,项目本地运行依旧没毛病,当你把项目打成jar包的时候,你会哭的,因为我就是哭着来改我的博客的

3.  ::前后一定要有空格

 

h:include 和 th:replace都是加载代码块内容,但是还是有所不同

 

  • th:include:加载模板的内容: 读取加载节点的内容(不含节点名称),替换div内容
  • th:replace:替换当前标签为模板中的标签,加载的节点会整个替换掉加载他的div 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值