📄 bulletin_del.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="error.jsp" %><%@ include file="initialization.jsp" %><%ResultSet rs=mysql.getResultSet("select count(*) rowCount from bulletin;");int rowCount=(rs.next()==true)?rs.getInt("rowCount"):0;int currentPage=0;String pageSerial=request.getParameter("pageSerial"); //页面序数String thisPage=application.getRealPath(request.getRequestURI()); //页面绝对路径if(pageSerial==null||pageSerial.equals("")) { currentPage=1; } else { currentPage=Integer.parseInt(pageSerial); }int recordsPerPage=Integer.parseInt(xml.getValue("/System/Pagination/RecordCount"));if(session.getAttribute("checkHash")==null){ session.setAttribute("checkHash",new HashMap<Long,Boolean>());}String checkSelected=request.getParameter("checkSelected");if(checkSelected!=null&&!checkSelected.equals("")){ String[] options=checkSelected.split("\\|"); for(int i=0;i<options.length;i++) { boolean tempB=options[i].indexOf('-')>=0?false:true; ((HashMap<Long,Boolean>)session.getAttribute("checkHash")).put(new Long(Math.abs(Long.parseLong(options[i]))),new Boolean(tempB)); }}if(request.getParameter("summit")!=null){ out.print(request.getParameter("summit")); if(request.getParameter("summit").equals("summit")) { HashMap<Long,Boolean> checkHash=(HashMap<Long,Boolean>)session.getAttribute("checkHash"); if(checkHash!=null&&!checkHash.isEmpty()) { Set<Long> checkSet =checkHash.keySet(); Iterator<Long> it=checkSet.iterator(); Long tempID=null; Boolean tempBo=null; while(it.hasNext()) { tempID=it.next(); tempBo=checkHash.get(tempID); if(tempBo.booleanValue()==true) { mysql.executeStatement("delete from bulletin where bulletinID="+tempID.longValue()+";"); } } checkHash.clear(); response.setHeader("Refresh","0"); //强制刷新 } }}//out.println(((HashMap<Long,Boolean>)session.getAttribute("checkHash")).size());%><jsp:useBean class="library.Pagination" id="pagination" scope="request"><% pagination.setRowCount(rowCount); pagination.setRecordsPerPage(recordsPerPage);%></jsp:useBean><% pagination.setCurrentPage(currentPage);//out.println(":"+pagination.getRowCount());//out.println(":"+pagination.getRecordsPerPage());//out.println(":"+pagination.getRecordCount());//out.println(":"+pagination.getPageCount());//out.println(":"+pagination.getCurrentPage());//out.println(":"+pagination.getBeginRow());rs=mysql.getResultSet("select * from bulletin limit "+(pagination.getBeginRow()-1)+","+pagination.getRecordCount()+";");%><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><link href="css/link.css" type="text/css" rel="stylesheet" /><link href="css/table.css" type="text/css" rel="stylesheet" /><script language="javascript" src="javascript/alternateshow.js"></script><script language="javascript" src="javascript/paginate.js"></script><script language="javascript" src="javascript/checkbox.js"></script><script language="javascript">function save(){ var temp=getCheckedCheckboxs('form1','checkbox'); var str=""; for(var i=0;i<temp.length;i++) { if(i==0) { str=temp[i]; } else { str+="|"+temp[i]; } } document.getElementById("checkSelected").value=str;}function mySummit() //summit()函数保留{ document.getElementById("summit").value="summit"; alert(document.getElementById("summit").value);}</script><title>无标题文档</title></head><body><table width="550" height="455" border="0" cellspacing="0" cellpadding="0" style="font-size:13px"> <tr> <td width="550" height="455" valign="top"> <form id="form1" name="form1" method="post" action=""> <table width="540" cellspacing="0" cellpadding="0" border="1" id="alternate" bordercolor="#C2D1E9" style=" border-bottom-color:#3399CC; border-left-color:#3399CC; border-right-color:#3399CC; border-top-color:#3399CC; font-size:12px" > <tr> <td width="42" height="24" align="center">删除</td> <td width="126" align="center">标题</td> <td width="190" align="center">内容</td> <td width="79" align="center">发布日期</td> <td width="88" align="center">发布者</td> </tr> <%while(rs.next()){%> <tr> <td height="21" align="center"> <input type="checkbox" name="checkbox" value=<%="\""+rs.getString("bulletinID")+"\""%> <% Boolean tempBool=((HashMap<Long,Boolean>)session.getAttribute("checkHash")).get(new Long(rs.getLong("bulletinID")));%> <%= tempBool==null||tempBool.booleanValue()==false?"":"checked" %>/> </td> <td height="21" align="center"> <a href="bulletin_det.jsp?bulletinID=<%=rs.getString("bulletinID")%>" title="<%=rs.getString("title")%>"> <%=text.elideText(rs.getString("title"),14)%></a></td> <td height="21" align="center"><%=text.elideText(rs.getString("content"),16)%></td> <td height="21" align="center"><%=rs.getString("promulgateDate") %></td> <td height="21" align="center"><%= rs.getString("promulgator") %></td> </tr> <% } %> <tr> <td height="37" colspan="5" align="right" bgcolor="#FFFFFF"> <input name="summit" type="hidden" id="summit" value=""> <input name="checkSelected" type="hidden" id="checkSelected" value=""> <input type="submit" name="Submit3" value="保存" alt="保存到操作车" onClick="save()"/> <input type="submit" name="Submit1" value="提交" alt="提交你所保存的操作" onClick="mySummit()"/> <input type="reset" name="Submit2" value="重置" /> </td></tr> <tr> <td align=middle height=30 colspan="5" id="paginate"> </td> </tr> </table> </form> </td> </tr></table><script language="javascript">paginate("paginate",<%="'"+text.getFileName(thisPage)+"'"%>,"pageSerial",<%=currentPage%>,7,<%=pagination.getPageCount()%>,"page_on","page_off");</script><script language="javascript">alternateShow("alternate","tablealternate1","tablealternate2",false,false);</script></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -