例如我想给添加一个属性data-page,可以根据(SpringEL/Ognl)表达式计算获得。
需求:
期望效果
app个数大于0,有数据时链接
<xxx data-page="/app/list">
app个数等于0,没有数据时链接如下
<xxx data-page="/app/create">
解决方法:
切换到Thymeleaf的数据属性语法,使用data-属性名称和连字符-
摘录自:thymeleaf 3.0.5中文参考手册
示例:
以下是笔者使用的代码
实际生成代码
例如我想给添加一个属性data-page,可以根据(SpringEL/Ognl)表达式计算获得。
期望效果
app个数大于0,有数据时链接
<xxx data-page="/app/list">
app个数等于0,没有数据时链接如下
<xxx data-page="/app/create">
切换到Thymeleaf的数据属性语法,使用data-属性名称和连字符-
摘录自:thymeleaf 3.0.5中文参考手册
以下是笔者使用的代码
实际生成代码
SpringBoot自定义starter
自定义安装微软 365
thymeleaf2.1.5自定义标签及自定义属性案例,类似于JSP中的自定义JSTL标签
前面只是简单说了自定义View,接下来我们再来个增强版——自定义View的属性1、自定义View的属性,首先在res/values/ 下建立一个a
结构
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M