SSM分页、多条件查询

来源:互联网 发布:上海浦东软件协会朱 编辑:程序博客网 时间:2024/05/21 03:56

jsp页面首页、尾页、上一页、下一页

================================================================================================================


    <c:if test="${empty orderList}">

 <tr><td colspan="10" style="text-align:center"><font color="#3598dc">查无数据</font></td></tr>
</c:if>
<c:if test="${not empty orderList}">
<c:forEach items="${orderList}" var="a" varStatus="status" >
   <tr>
<td style="padding:0 0 0 5px;width:80px;">${ status.index + 1+offset}</td>
<td style="padding:0 0 0 5px;width:100px;">${a.order_id }</td>
<td style="padding:0 0 0 5px;width:100px;">${a.real_name }</td>
<td style="padding:0 0 0 5px;width:100px;">${a.identification }</td>
<td style="padding:0 0 0 5px;width:40px;">
<c:if test="${a.sex==1 }">男</c:if>
                <c:if test="${a.sex==2 }">女</c:if>
                <c:if test="${a.sex==3 }">不确定</c:if></td>
                <td style="padding:0 0 0 5px;width:130px;">${a.phone_num }</td>
                <td style="padding:0 0 0 5px;width:230px;"><fmt:formatDate value="${a.upd_ymdhms}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                <td style="padding:0 0 0 5px;width:80px;">
                <c:if test="${a.status==1 }"> 等待支付</c:if>
                <c:if test="${a.status==2 }"> 已取消</c:if>
                <c:if test="${a.status==3 }"> 支付完成</c:if></td>
<td style="padding:0 0 0 5px;width:100px;">${a.sysuser_name }</td>
<td style="padding:0 0 0 5px;width:170px;">
<a href="SearchOrderByOrderId.action?orderId=${a.order_id }">
<span class="handle" id="see_order">查看</span></a>&nbsp;

<c:if test="${a.status==1 }">|&nbsp;

<a href="UpdateOrderStatus.action?orderId=${a.order_id }"><span class="handle">取消</span></a>&nbsp;</c:if>|&nbsp;

<a href="UpdateOrderUp.action?orderId=${a.order_id }"><span class="handle" id="edi_order">编辑</span></a></td>

   </tr>
   </c:forEach>

   </c:if>



controller部分代码

================================================================================================================


List<OrderCustomerSysuser> ocslist = orderService.findOrderCustomerSysuser(sysuserId,offset, pagesize, real_name,phone_num, order_id);

int count = orderService.selectCountToOrderCustomSysuser(sysuserId,real_name, phone_num, order_id);
int pageTemp=10;

                //pageCount 为页数
int pageCount = count%pageTemp==0?count/pageTemp:count/pageTemp+1;

                //当前是第几页
int currentPage = offset / pagesize + 1;

ModelAndView modelAndView = new ModelAndView();

modelAndView.addObject("orderList", ocslist);
modelAndView.addObject("phone_num", phone_num);
modelAndView.addObject("order_id", order_id);
modelAndView.addObject("real_name", real_name);

                modelAndView.addObject("offset", offset);//从第几条开始查询
modelAndView.addObject("pagesize", pagesize);//每页显示几条数据
modelAndView.addObject("pageCount", pageCount);//为页数
modelAndView.addObject("currentPage", currentPage);//当前是第几页
modelAndView.addObject("count", count);

// 指定视图
modelAndView.setViewName("/Order_management.jsp");
return modelAndView;

0 0
原创粉丝点击