?? bbc_index.jsp
字號:
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import="java.util.*"%>
<jsp:directive.page import="com.hiernate.persistence.Placard"/>
<jsp:directive.page import="com.hiernate.util.HibernateUtil"/>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<html:base />
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<style type="text/css">
<!--
@import url("../../CSS/style.css");
-->
</style>
</head>
<body background="../../Images/main_center.jpg">
<table width="801" height="505" border="0" cellpadding="0" cellspacing="0" background="../../Images/main_center.JPG">
<tr>
<td height="488" valign="top"><table width="100%" height="84%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><table width="100%" height="119" border="0" cellpadding="-2" cellspacing="-2" background="../images/bbs/bbs_01.gif">
<tr valign="top">
<td width="100%" height="43" background="../../Images/main_top.JPG"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<tr>
<td width="5%"><br> <img src="../../Images/isexists.gif" width="16" height="16"></td>
<td width="23%" align="left"><br> <b>公告管理</b></td>
<td width="72%" valign="bottom"> </td>
</tr>
</table></td>
</tr>
<tr valign="top">
<td> </td>
</tr>
</table>
<table width="672" border="0" cellpadding="-2" cellspacing="-2">
<tr>
<td width="817" valign="top"><table width="557" height="54" border="0"
cellpadding="-2" cellspacing="-2" background="../Images/bbs/bbs_02.gif">
<tr>
<td width="8%" height="33" align="center" valign="middle"> </td>
<td width="19%" align="center"> </td>
<td width="6%" height="33"><div align="center" class="style10"> <img src="../../Images/add.gif" width="20" height="18"></div></td>
<td width="37%" height="33"><div align="left" class="STYLE11">
<%
String strpurview = (String)application.getAttribute("Purview");
if(strpurview.equalsIgnoreCase("只讀")){
%>
<a href="noaddbbc.jsp">添加新公告</a>
<%}else{ %>
<a href="#" class="STYLE11" onClick="JScript:window.open('bbc_add.jsp','','width=545,height=380');return false"> 添加新公告</a>
<%} %>
</div></td>
<td width="30%" height="33"><div align="center"></div></td>
</tr>
<tr>
<td height="21" colspan="6"> </td>
</tr>
</table>
<table width="89%" height="42" border="1" align="right" cellpadding="-2" cellspacing="-2">
<tr>
<td width="54%"><div align="center" class="STYLE11">公告主題</div></td>
<td width="10%"><div align="center" class="STYLE11">公布人</div></td>
<td width="21%"><div align="center" class="STYLE11">公布時間</div></td>
<td width="8%"><div align="center" class="STYLE11">修改</div></td>
<td width="7%"><div align="center" class="STYLE11">刪除</div></td>
</tr>
<%
String currPage = request.getParameter("currPage");
int iCurrPage = 1 ;
int pages = 1 ;
int allRecCount = 0 ;
int recPerPage = 5 ;
allRecCount = HibernateUtil.findPlacardCount(); //查詢出總的記錄數
pages = (allRecCount - 1)/recPerPage + 1 ; //計算出總的頁數
if(pages == 0){ //對頁數進行有效性處理,使頁數的最小值是1
pages = 1;
}
if(currPage != null && !currPage.equalsIgnoreCase("")){
iCurrPage = Integer.parseInt(currPage);
}
List listPlacard =HibernateUtil.finplacard((iCurrPage - 1) * recPerPage, recPerPage);;
if(listPlacard.isEmpty()){
out.println("暫無信息");
}
if(!listPlacard.isEmpty() && listPlacard.size()>0){
for(int i=0;i<listPlacard.size();i++){
Placard placard = (Placard)listPlacard.get(i);
%>
<tr>
<td>
<a href="#" class="STYLE11" onClick="window.open('bbc_detail.jsp?id=<%=placard.getId()%>','','width=545,height=340');return false;"> <%=placard.getSubject()%></a></td>
<td><div align="center" class="STYLE11"><%=placard.getPerson()%></div></td>
<td class="STYLE11"><div align="center" class="style10"><%=placard.getDDate()%></div></td>
<td class="STYLE11"><div align="center" class="STYLE11">
<% String purview = (String)application.getAttribute("Purview"); //獲得將保存在application中的登錄用戶權限
if(purview.equalsIgnoreCase("只讀")){ //如果用戶的權限是"只讀",將轉入meeting_delno.jsp頁面,不能進行刪除操作。
%>
<a href="bbc_nomodify.jsp"> <!-- 提供進入不可修改公告信息頁面的超鏈接 -->
<img src="../../Images/modify.gif" width="12" height="12" border="0"></td>
<td>
<a href="bbc_nomodify.jsp">
<img src="../../Images/del.gif" width="16" height="16" border="0"></td>
<%}%>
<%if(purview.equalsIgnoreCase("系統")){ %> <!-- 用戶的權限為“系統”可以進行修改和刪除操作 -->
<a href="#" onClick="JScript:window.open('bbc_modify.jsp?ID=<%=placard.getId()%>','','width=545,height=330');return false"><!--以新窗體形式打開修改頁面,并把公告的id號作為請求參數 -->
<img src="../../Images/modify.gif" width="12" height="12" border="0"></a>
<td><div align="center" class="STYLE11">
<a href="#" onClick="JScript:window.open('bbc_del.jsp?IDs=<%=placard.getId()%>&link=<%=listPlacard.size()%>&currPage=<%=iCurrPage%>','','width=550,height=397');return false"><img src="../../Images/del.gif" width="16" height="16" border="0"></a>
</div></td>
</tr>
<%}}}%>
</table>
</td>
</tr>
</table>
<table width="600" border="0" cellspacing="-2" cellpadding="-2">
<tr>
<td><div align="right" class="STYLE11">
<%
if(recPerPage < allRecCount){
String href = " <a href='bbc_index.jsp?currPage=";
StringBuffer sbf = new StringBuffer(); //制作分頁條
if(iCurrPage > 1){ //構造上一頁
sbf.append(href+(iCurrPage - 1)+"'>上一頁</a>");
}
for(int i = 1 ; i <= pages ; i ++){
if(i == iCurrPage){
sbf.append(href+i+"'>["+i+"]</a>"); //追加串
}
else{
sbf.append(href+i+"'>"+i+"</a>");
}
}
if(iCurrPage < pages){
sbf.append(href+(iCurrPage + 1)+"'>下一頁</a>"); //構造下一頁
}
%>
<%out.print("當前頁數:["+iCurrPage+"/"+pages+"]");%>
<%=sbf.toString()%>
<%} %>
</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</body>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -