thymeleaf中th:attr用法
来源:互联网 发布:死而后已不亦远乎意思 编辑:程序博客网 时间:2024/06/03 12:52
遇到好几个人问关于th:attr使用报错,不支持里面存在 '' 的问题。还有属性值获取拼接的问题。
刚好现在有点时间,顺便写一下我自己对th:attr的理解吧。
首先,th:attr可以设置多个属性值,可以将属性值写死,当然也可以获取。
其次,里面配合‘|‘使用可以实现属性值拼接等问题。
废话不多说了,还是来几个示例吧!
1、写死的单个属性值添加th:attr="class=btn"2、写死的多个属性值添加th:attr="class=btn,title=link"3、当一个属性的值较多的时候可以用 | th:attr="class=|btn btn-group|"4、属性值动态赋值th:attr="value=#{obj.value},title=#{obj.title}"5、动态拼接属性值th:attr="value=select_val|#{obj.val}|"6、属性值中有引号的情况th:attr="data-am-collapse=|{target:'#collapse-nav5'}|"
OK了,先写到这吧。后续有什么问题我还会在博客中补充!
自己记录为主,能帮到大家更好!
阅读全文
0 0
- thymeleaf中th:attr用法
- thymeleaf 修改th:text attr/css
- 如何用th:attr标签在thymeleaf模板中设置属性-原标题:How To Set Attributes in Thymeleaf Template using th:attr?
- thymeleaf中的th:each用法
- thymeleaf中的th:assert用法
- thymeleaf中的th:remove用法
- thymeleaf中th标签整理
- using thymeleaf之七设置属性的值(th:attr/th:value/th:alt-title/th:attrappend/th:attrprepend/th:checked)
- js中attr的用法
- Android 中Attr 和TypedArray的用法
- jquery中attr()方法介绍和用法
- thymeleaf th:replace th:include th:insert 的区别
- thymeleaf th:replace th:include th:insert 的区别
- Thymeleaf教程(三)th标签整理
- thymeleaf标签之th:href的使用
- thymeleaf标签之th:text的使用
- thymeleaf th:text 不显示标签
- using thymeleaf之六th:text/th:utext属性
- webpack 压缩打包 vue.js 项目 懒加载快速加载页面
- NOIP 2017 Day1 题3:逛公园 最短路径+动态规划
- 无法改变规则,那就改变自己
- android 相对布局属性
- Chrome 控制台console的用法
- thymeleaf中th:attr用法
- strcpy和memcpy的区别
- Observer 设计模式 了解委托与事件的使用
- poj2808校门外的树
- solidity读书笔记
- 【语音识别】Microsoft Speech Platform 自学笔记2 环境要求与安装过程
- PHP字符串处理函数表
- 吴恩达深度学习笔记之卷积神经网络(卷积网络)
- 学习笔记-Redis