ui做自适应网站,举例说明seo,手机上怎么赚钱啊 正规,html动漫网站模板下载大家好#xff0c;我是雄雄#xff0c;欢迎关注公众号【雄雄的小课堂】。最近#xff0c;换了个桌面手机的也同步换了下#xff1a;哈哈哈#xff0c;自己看着舒服就行~这几天在业余时间搞一个电商项目#xff0c;可以说是边学边做#xff0c;效率比较低#xff0c;但是… 大家好我是雄雄欢迎关注公众号【雄雄的小课堂】。最近换了个桌面手机的也同步换了下哈哈哈自己看着舒服就行~这几天在业余时间搞一个电商项目可以说是边学边做效率比较低但是通过做这个项目的的确确的能学到不少每天都抽出点时间往后做做bug在不知不觉中解决……今天主要是记录一下thymeleaf在前台的迭代读取与遍历。以前在遇到页面中数据迭代时用的最多的要数jstl表达式了除了jstl表达式外thymeleaf倒也是个不错的选择并且使用起来也特别简单。首先需要引入thymeleaf依赖代码如下dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-thymeleaf/artifactId/dependency通过springmvc获取到数据放在model中就可以在页面中获取控制器中的代码如下所示//查询所有的商品信息RequestMapping(getProList)public String findAllPro(Model model){model.addAttribute(proList,productService.findAllProduct());return proList;}然后在页面中我们就可以遍迭代数据了。迭代表格table classlayui-table lay-sizelgcolgroupcol width150col width200col/colgrouptheadtrth编号/thth名称/thth图片/thth价格/thth库存/thth描述/thth操作/th/tr/theadtbody!--遍历用户信息--tr th:eachpro : ${proList}td th:text${pro.id}/tdtd th:text${pro.name}/tdtdimg th:src/images/${pro.fileName} width50px height50px/tdtd th:text${pro.price}/tdtd th:text${pro.stock}/td!-- td th:if${#strings.isEmpty(pro.description)}暂无描述/td--td th:text${pro.description eq null or pro.description eq }? 暂无描述:${pro.description}/tdtdbutton typebutton classlayui-btn layui-btn layui-btn-normal layui-btn-xsi classlayui-icon#xe642;/i/buttonbutton typebutton classlayui-btn layui-btn-danger layui-btn-xsi classlayui-icon#xe640;/i/button/td/tr/tbody
/table迭代下拉列表div classlayui-input-inline stylewidth: 20%select namecategorylevelthreeId idthreeoption value请选择/optionoption th:eachcate : ${threeList} th:value${cate.id} th:text${cate.name}/option/select/div其他迭代基本都一样那如果我们需要在迭代的过程中判断该如何写呢可以使用下面两种方式td th:text${user.state eq 0}? 已禁用 : 正常使用 /tdtd th:text${pro.description eq null or pro.description eq }? 暂无描述:${pro.description}/td效果如下往期精彩30个IDEA插件总有一款适合你2021-03-18 装完就跑这几个Linux指令真的高大上2021-03-17 你是前端开发还是后端开发2021-03-16 深夜我偷听到程序员要对session下手……2021-03-13 springboot点击运行没反应什么都不显示的解决方式2021-03-11 点分享点点赞点在看