日期:2014-05-17 浏览次数:20719 次
<%@page import="javax.jms.Session"%> <%@page import="org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.QueryStats"%> <%@page import="javax.management.Query"%> <%@page import="javax.jms.QueueSession"%> <%@page import="java.text.SimpleDateFormat"%> <%@page import="java.sql.ResultSet"%> <%@page import="model.config.Config"%> <%@page import="com.whale.empire.MysqlDB"%> <%@page import="java.util.*" %> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="_header.jsp"%> <script language="javascript" type="text/javascript" src="../js/My97DatePicker/WdatePicker.js""> </script> <% MysqlDB db = new MysqlDB(Config.inst().mstr); java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, -1); Date date2 = cal.getTime(); String startTime = request.getParameter("startTime"); if(startTime==null) startTime=sdf.format(date2); String endTime = request.getParameter("endTime"); if(endTime==null) endTime=sdf.format(date); int pageSize = 2;//一页显示的记录数 String page2 = request.getParameter("page");//取得待显示页码 Integer page1 = 0;//待显示页码 if(page2 == null || page2.equals("")) page1 = 0; else page1 = Integer.parseInt(page2); if (page1 < 0) page1 = 0; %> <form method="post"> <p>查询日期:<input name="startTime" type="text" class="Wdate" onClick="WdatePicker()" value="<%=startTime%>"/>到 <input name="endTime" type="text" class="Wdate" onClick="WdatePicker()"value="<%=endTime%>"/> <input type="submit" value="查询"></p> </form> <table border=1 width=400 class=data> <tr><th>用户ID</th><th>用户来源</th><th>邀请时间</th><th>平台</th></tr> <tr> <% int rowCount = db.count("select count(id) from invited WHERE add_time>='"+ startTime + "' and date(add_time)<='"+ endTime + "'");//记录总数 int pageCount = (rowCount-1)/pageSize;//计算总页数 if (page1>pageCount) page1 = pageCount; int i =0; ResultSet rs = db.query("select * from invited WHERE add_time>='"+ startTime + "' and date(add_time)<='"+ endTime + "' ORDER BY add_time DESC LIMIT "+page1*pageSize+","+pageSize+""); while( rs.next()){ %> <tr> <td><%=rs.getString(2)%></td> <td><%=rs.getString(3)%></td> <td><%=rs.getString(4)%></td> <td><%=rs.getString(5)%></td> </tr> <% i++; } %> <tr> <td colspan=5 align="center"> <a href="?page=<%=((page1 - 1) >= 0 ? (page1-1):0)%>">上一页</a> ||第<%=page1+1%>页| 共<%=pageCount+1%>页||<a href="?page=<%=(page1 + 1)%>">下一页</a> </td> </tr> <tr> <td colspan=5 align="center"><%int j; for(j=0;j<pageCount+1;j++){%> <a href="invited.jsp?page=<%=j%>"><%=j+1%></a> <%}%> </td></tr> </table> <%@include file="_footer.jsp"%>