fmt标签对时间格式化,和pageHelper分页的展示使用

使用jstl表达式进行c:forEach进行循环集合
使用fmt标签,对时间进行格式化


<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>


<c:forEach items="${pageInfo.list}" var="product">
<tr>
		<td><input name="ids" type="checkbox" id="checkOne"></td>
		<td>${product.id }</td>
		<td>${product.productNum }</td>
		<td>${product.productName }</td>
		<td>${product.cityName }</td>
		<td>
			<%-- 将时间进行格式化--%>
			<fmt:formatDate  value="${product.departureTime}" pattern="yyyy-MM-dd HH:ss:mm"/>
		</td>
		<td class="text-center">${product.productPrice}</td>
		<td>${product.productDesc }</td>
		<%--将响应数据进行替换,如果为1显示开启,为0显示关闭 --%>
		<td class="text-center">
			<c:if test="${product.productStatus==1}">
				开启
			</c:if>
			<c:if test="${product.productStatus==0}">
				关闭
			</c:if>
		</td>
		<td class="text-center">
			<button type="button" class="btn bg-olive btn-xs">订单</button>
			<button type="button" class="btn bg-olive btn-xs">详情</button>
			<button type="button" class="btn bg-olive btn-xs">编辑</button>
		</td>
	</tr>
</c:forEach>
   <!-- 正文区域 -->
        <section class="content">

            <!-- .box-body -->
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h3 class="box-title">列表</h3>
                </div>

                <div class="box-body">

                    <!-- 数据表格 -->
                    <div class="table-box">

                        <!--工具栏-->
                        <div class="pull-left">
                            <div class="form-group form-inline">
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default" title="新建"
                                            onclick="location.href='${pageContext.request.contextPath}/pages/product-add.jsp'">
                                        <i class="fa fa-file-o"></i> 新建
                                    </button>
                                    <button type="button" class="btn btn-default" title="删除" id="removeOrder">
                                        <i class="fa fa-trash-o"></i> 删除
                                    </button>
                                    <button type="button" class="btn btn-default" title="开启">
                                        <i class="fa fa-check"></i> 开启
                                    </button>
                                    <button type="button" class="btn btn-default" title="屏蔽">
                                        <i class="fa fa-ban"></i> 屏蔽
                                    </button>
                                    <button type="button" class="btn btn-default" title="刷新">
                                        <i class="fa fa-refresh"></i> 刷新
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="box-tools pull-right">
                            <div class="has-feedback">
                                <input type="text" class="form-control input-sm"
                                       placeholder="搜索"> <span
                                    class="glyphicon glyphicon-search form-control-feedback"></span>
                            </div>
                        </div>
                        <!--工具栏/-->

                        <!--数据列表-->
                        <form action="${pageContext.request.contextPath}/orders/remove.do" method="post"
                              id="removeForm">
                            <table id="dataList"
                                   class="table table-bordered table-striped table-hover dataTable">
                                <thead>
                                <tr>
                                    <th class="" style="padding-right: 0px;"><input
                                            id="selall" type="checkbox" class="icheckbox_square-blue">
                                    </th>
                                    <th class="sorting_asc">ID</th>
                                    <th class="sorting_desc">订单编号</th>
                                    <th class="sorting_asc sorting_asc_disabled">产品名称</th>
                                    <th class="sorting_desc sorting_desc_disabled">金额</th>
                                    <th class="sorting">下单时间</th>
                                    <th class="text-center sorting">订单状态</th>
                                    <th class="text-center">操作</th>
                                </tr>
                                </thead>
                                <tbody>

                                <c:forEach items="${pageInfo.list}" var="orders">

                                    <tr>
                                        <td><input name="ids" type="checkbox" value="${orders.id}"></td>
                                        <td>${orders.id}</td>
                                        <td>${orders.orderNum}</td>
                                        <td>${orders.product.productName}</td>
                                        <td>${orders.product.productPrice}</td>
                                        <td>
                                            <fmt:formatDate value="${orders.orderTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                                        </td>
                                        <td class="text-center">
                                            <c:if test="${orders.orderStatus==1}">开启</c:if>
                                            <c:if test="${orders.orderStatus==0}">关闭</c:if>

                                        </td>
                                        <td class="text-center">
                                            <button type="button" class="btn bg-olive btn-xs">订单</button>
                                            <button type="button" class="btn bg-olive btn-xs"
                                                    onclick="location.href='${pageContext.request.contextPath}/orders/findById.do?id=${orders.id}'">
                                                详情
                                            </button>
                                            <button type="button" class="btn bg-olive btn-xs">编辑</button>
                                        </td>
                                    </tr>
                                </c:forEach>
                                </tbody>
                                <!--
                            <tfoot>
                            <tr>
                            <th>Rendering engine</th>
                            <th>Browser</th>
                            <th>Platform(s)</th>
                            <th>Engine version</th>
                            <th>CSS grade</th>
                            </tr>
                            </tfoot>-->
                            </table>
                        </form>
                        <!--数据列表/-->


                        <div class="box-tools pull-right">
                            <div class="has-feedback">
                                <input type="text" class="form-control input-sm"
                                       placeholder="搜索"> <span
                                    class="glyphicon glyphicon-search form-control-feedback"></span>
                            </div>
                        </div>
                        <!--工具栏/-->

                    </div>
                    <!-- 数据表格 /-->


                </div>
                <!-- /.box-body -->

                <!-- .box-footer-->
                <div class="box-footer">
                    <div class="pull-left">
                        <div class="form-group form-inline">
                            总共${pageInfo.pages}页,共${pageInfo.total}条数据。 每页
                            <select class="form-control" id="changePageSize" onchange="changePageSize()" >
                                <option>1</option>
                                <option>2</option>
                                <option>3</option>
                                <option>4</option>
                            </select> 条
                        </div>
                    </div>

                    <div class="box-tools pull-right">
                        <ul class="pagination">
                            <li>
                                <a href="${pageContext.request.contextPath}/orders/findAll.do?pageNum=${pageInfo.navigateFirstPage}"
                                   aria-label="Previous">首页</a>
                            </li>

                            <li>
                                <a href="${pageContext.request.contextPath}/orders/findAll.do?pageNum=${pageInfo.prePage}">上一页</a>
                            </li>
                            <c:forEach begin="1" end="${pageInfo.pages}" var="i">
                                <li><a href="${pageContext.request.contextPath}/orders/findAll.do?pageNum=${i}">${i}</a>
                                </li>
                            </c:forEach>

                            <li>
                                <a href="${pageContext.request.contextPath}/orders/findAll.do?pageNum=${pageInfo.nextPage}">下一页</a>
                            </li>

                            <li>
                                <a href="${pageContext.request.contextPath}/orders/findAll.do?pageNum=${pageInfo.navigateLastPage}"
                                   aria-label="Next">尾页</a>
                            </li>
                        </ul>
                    </div>
                </div>
                <!-- /.box-footer-->


            </div>

        </section>
        <!-- 正文区域 /-->
<script>

    function changePageSize() {
        //获取下拉框的值
        var pageSize = $("#changePageSize").val();

        //向服务器发送请求,改变每页显示条数
        location.href = "${pageContext.request.contextPath}/orders/findAll.do?pageNum=1&pageSize=" + pageSize;
    }

    //修改option的值为当前页面-1,索引从0开始,修改option的属性为默认被选中的状态.
    $("#changePageSize>option").eq(${param.pageSize-1}).prop("selected",true);



    $(document).ready(function () {
        // 选择框
        $(".select2").select2();

        // WYSIHTML5编辑器
        $(".textarea").wysihtml5({
            locale: 'zh-CN'
        });
    });

    // 设置激活菜单
    function setSidebarActive(tagUri) {
        var liObj = $("#" + tagUri);
        if (liObj.length > 0) {
            liObj.parent().parent().addClass("active");
            liObj.addClass("active");
        }
    }

    $(document).ready(function () {

        // 激活导航位置
        setSidebarActive("admin-datalist");

        // 列表按钮
        $("#dataList td input[type='checkbox']").iCheck({
            checkboxClass: 'icheckbox_square-blue',
            increaseArea: '20%'
        });
        // 全选操作
        $("#selall").click(function () {
            var clicks = $(this).is(':checked');
            if (!clicks) {
                $("#dataList td input[type='checkbox']").iCheck("uncheck");
            } else {
                $("#dataList td input[type='checkbox']").iCheck("check");
            }
            $(this).data("clicks", !clicks);
        });
    });

    //删除选中的订单数据
    $("#removeOrder").click(function () {
        $("#removeForm").submit();
    });

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值