首页 > 其他 > 详细

thymeleaf

时间:2019-04-22 23:35:59      阅读:135      评论:0      收藏:0      [点我收藏+]

thymeleaf使用Demo(页面部分代码)

@Controller
@RequestMapping("/order")
public class OrderController {

       @RequestMapping("/orderlist")
        public String orderList(User user,ModelMap map){
        List<Orders> orders = ordersService.queryOrdersByUid(user.getId());
        //System.out.println("订单列表数据: "+orders);
        map.put("orders",orders);
        return "orderlist";
    }
}

 

<-- orderlist.html -->
<!--
右边购物列表 --> <div class="shop_member_bd_right clearfix"> <div class="shop_meber_bd_good_lists clearfix"> <div class="title"><h3>订单列表</h3></div> <table> <thead class="tab_title"> <th style="width:410px;"><span>商品信息</span></th> <th style="width:100px;"><span>单价</span></th> <th style="width:80px;"><span>数量</span></th> <th style="width:100px;"><span>订单总价</span></th> <th style="width:115px;"><span>状态与操作</span></th> </thead> <tbody> <!-- 一个订单 --> <tr th:each="order : ${orders}"> <td colspan="5"> <table class="good"> <thead > <tr><th colspan="6"> <span><strong>订单号码:</strong>[[${order.orderid}]]</span> </th></tr> </thead> <tbody> <!-- 一个订单详情 --> <tr th:each="orderdetil,orderdetilState : ${order.orderDetils}"> <td class="dingdan_pic"><img style="height: 80px;width: 100px" th:src="|http://xx.xx.xx.xx/${#strings.setSplit(orderdetil.gimage, ‘|‘)[0]}|" src="images/1dbc94fa0d60cba3990b89ccb01f82c2.jpg_tiny.jpg" /></td> <td class="dingdan_title"><span><a th:text="${orderdetil.gname}">李宁 lining 专柜正品 足球鞋 女式运动鞋【演示数据】</a></span><br /></td> <td class="dingdan_danjia"><strong th:text="${orderdetil.gprice}">25.00</strong></td> <td class="dingdan_shuliang" th:text="${orderdetil.gnumber}">1</td> <!-- 后两列跨行 th:if="${orderdetilState.first}" 如果是第一行,first返回ture 就显示这条记录 --> <td th:rowspan="${#arrays.length(order.orderDetils)}" th:if="${orderdetilState.first}" class="dingdan_zongjia"><strong th:text="${order.allprice}">25.00</strong><br />(免运费)</td> <td th:switch="${order.status}" th:rowspan="${#arrays.length(order.orderDetils)}" th:if="${orderdetilState.first}" class="digndan_caozuo"> <a th:case="0">待付款<br/> <a th:href="|/pay/alipay?orderid=${order.orderid}|">去付款</a></a> <a th:case="1">待发款</a> <a th:case="2">待收货</a> <a th:case="3">已收货</a> </td> </tr> </tbody> </table> </td></tr> </tbody> </table> </div> </div>

页面效果:

技术分享图片

 

thymeleaf

原文:https://www.cnblogs.com/wakey/p/10753812.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!