日期:2014-05-20 浏览次数:20790 次
<form name="log" action="select.jsp" method="post"> <table cellspacing="3" cellpadding="5"> <tr> <td> 所在区域: </td> <td></td> </tr> <tr> <td> 所在学校: </td> <td> <select name="schoolname" id="school" style="width:120px" onchange="getSxt()"> </select> </td> </tr> <tr> <td> 摄像头编号: </td> <td> <select name="sxtname" id="sxt" style="width:120px"> </select> </td> </tr> <tr> <td> 工作记录: </td> <td> <input type="radio" name="workinfo" value="正常" checked="checked" onclick="showError()"/> 正常 <input type="radio" name="workinfo" value="异常" onclick="showError()"/> 异常 </td> </tr> <tr> <td><b id="temp" style="display: none">异常记录:</b></td> <td><input type="text" name="errorinfo" style="display: none"/></td> </tr> <tr> <td> 巡检日期: </td> <td> <input type="text" name="logdateA" onfocus="HS_setDate(this)"/> </td> </tr> <tr> <td> 巡检人: </td> <td> <input type="text" name="logpersonA" /> </td> </tr> <tr> <td> <input type="submit" value="查 询 " /> </td> <td> <input type="reset" value="重 置 " onclick="window.location.reload()"/> </td> </tr> </table> </form>
<% request.setCharacterEncoding("utf-8"); Connection con = null; Statement st = null; ResultSet res = null; String area = request.getParameter("area"); String school = request.getParameter("schoolname"); String sxt = request.getParameter("sxtname"); String workinfo = request.getParameter("workinfo"); String errorinfo = request.getParameter("errorinfo"); String logdateA = request.getParameter("logdateA"); String logpersonA = request.getParameter("logpersonA"); int pageSize = 10; int currentPage = 1; int totalPage = -1; try { con = DBToll.connectDB(); st = DBToll.createStatement(con); String pages = request.getParameter("pages"); totalPage = LogToll.getTotalPage(pageSize, st); if (null != request.getAttribute("temppage")) { currentPage = Integer.parseInt((String) request .getAttribute("temppage")); } if (pages != null && pages.equals("a")) { currentPage = Integer.parseInt(request .getParameter("currentPage")); currentPage--; if (currentPage < 1) { currentPage = 1; } } else if (pages != null && pages.equals("b")) { currentPage = Integer.parseInt(request .getParameter("currentPage")); currentPage++; if (currentPage < 1) { currentPage = 1; } } else if (pages != null) { int tempPages = 1; tempPages = Integer.valueOf(pages).intValue(); if (tempPages > 0) { currentPage = tempPages; } else { currentPage = 1; } } if (currentPage > totalPage) { currentPage = totalPage; } res = LogToll.findLogByPage(area,school,sxt,workinfo,errorinfo,logdateA,logpersonA,currentPage, pageSize, st); int k = 0; while (res.next()) { k++; if ((k % 2) == 0) out.println("<tr align='center' bgcolor='F3F9F9'>"); else out.println("<tr align='center' bgcolor='F7F8CA'>"); %> <td><%=k + (currentPage - 1) * pageSize%></td> <td><%=DBToll.checkNull(2, res)%></td> <td><%=DBToll.checkNull(3, res)%></td> <td><%=DBToll.checkNull(4, res)%></td> <td><%=DBToll.checkNull(5, res)%></td> <td><%=DBToll.checkNull(6, res)%></td> <td><%=DBToll.checkNull(7, res)%></td> <td><%=DBToll.checkNull(8, res)%></td> <td><%=DBToll.checkNull(9, res)%></td> <td><%=DBToll.checkNull(10, res)%></td> <td><%=DBToll.checkNull(11, res)%></td> <td><%=DBToll.checkNull(12, res)%></td> <%if(session.getAttribute("type").equals("SUPER")){ out .print("<td><a href='deleteLog?id=" + DBToll.checkNull(1, res) + "&¤tPage=" + currentPage + "' onclick=\"return yesorno('" + DBToll.checkNull(2, res) + "')\"><img src='goLight/de.png' border='0'/></a></td>"); out .print("<td><a href='logUpdate.jsp?id=" + DBToll.checkNull(1, res) + "' ><img src='goLight/al.png' border='0'</a></td>"); %> <td> <input type="checkbox" name="select" value=<%=DBToll.checkNull(1, res)%> /> </td> <% }} %> </tr> </table> <input type="hidden" name="currentPage" value=<%=currentPage%> /> </form> <%if(session.getAttribute("type").equals("SUPER")){ %> <a href="#" onclick="return testDelete();">删除选中 </a> <a href="#" onclick="selectAll();">全部选中 </a> <a href="#" onclick="cancelSelect();">取消选中</a> <a href="#" onclick="selectReverse();">选择反选</a> <%} %> <br /> <% out.println("共" + totalPage + "页"); %> <br /> <% if (currentPage > 1) { %> <a href="logSelectResult.jsp?pages=1">首页</a> <a href="logSelectResult.jsp?pages=a&¤tPage=<%=currentPage%>">上一页</a> <% } for (int i = -3; i <= 3; i++) { if ((currentPage + i) > totalPage || (currentPage + i) < 1) { continue; } if (currentPage + i == currentPage) { out.println("<a href=logSelectResult.jsp?pages=" + (currentPage + i) + "><font color='blue' size='5'>" + (currentPage + i) + "</font></a>"); } else { out.println("<a href=logSelectResult.jsp?pages=" + (currentPage + i) + ">" + (currentPage + i) + "</a>"); } } %> <% if (currentPage < totalPage) { %> <a href="logSelectResult.jsp?pages=b&¤tPage=<%=currentPage%>">下一页</a> <a href="logSelectResult.jsp?pages=<%=totalPage%>">尾页</A> <% } } finally { if (st != null) st.close(); if (con != null) con.close(); } %>