?? selectnews.jsp
字號:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.util.List"%>
<%@ page import="com.actionForm.NewsForm"%>
<jsp:useBean id="chinese" scope="request" class="com.tool.Chinese"/>
<jsp:useBean id="sortDao" scope="request" class="com.dao.SortDao"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>宇晨網絡新聞中心后臺</title>
<script language="javascript">
function deleteForm(date1,date2){
if(confirm("您真的要刪除嗎?")){
window.location.href="newsAction.do?method=deleteNewsAction&bigSort="+date1+"&id="+date2;
}
}
</script>
</head>
<%
String bigSort=chinese.toChinese(request.getParameter("bigSort"));
List list=(List)request.getAttribute("list");
int number=list.size();
//以下這段代碼是計算多少頁數
int pageNumber=number;
if(pageNumber%11==0){
pageNumber=pageNumber/11;
}else{
pageNumber=pageNumber/11+1;
}
//以下是計算當前頁的頁數
int count;
if(request.getParameter("count")==null){
count=0;
}else{
count=Integer.valueOf(request.getParameter("count"));
}
//以下顯示多少條紀錄
int start=count*11;//開始條數
int over=(count+1)*11;//結束條數
int lastCount=number-over;//還剩多少條記錄
if(lastCount<=0){
over=number;
}
%>
<body><div align="center">
<jsp:include page="../bTop.jsp"/>
<table width="800" height="465" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="196" rowspan="2" valign="top"><jsp:include page="../bleft.jsp"/></td>
<td width="604" height="57" background="bImage/place.jpg" >
<table width="601" height="36" border="0" cellpadding="0" cellspacing="0">
<tr>
<td> 當前位置提示 >> <%=bigSort%></td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="400" align="center" valign="top" background="bImage/big.jpg"><table width="601" border="0" cellpadding="0" cellspacing="0" background="bImage/placeNext.jpg">
<tr>
<td height="21" > </td>
<td><%=chinese.toChinese(request.getParameter("bigSort"))%>——類新聞管理</td>
</tr>
</table>
<%if(number==0){%><br>沒有新聞?。?!<br><br>
<br>
<a href="newsAction.do?method=insertNewsAction&bigSort=<%=bigSort%>">添加新聞</a> 或者 <a href="sortAction.do?method=selectSortAction&bigSort=<%=bigSort%>">詳細類別管理</a>
<%}else{%>
<table width="500" border="0">
<tr>
<td width="331"><div align="right"></div></td>
<td width="79" ><div align="right"><a href="sortAction.do?method=selectSortAction&bigSort=<%=bigSort%>">詳細類別管理</a></div></td>
<td width="76" ><div align="right"><a href="newsAction.do?method=insertNewsAction&bigSort=<%=bigSort%>">添加新聞</a></div></td>
</tr>
</table>
<table width="500" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="64" height="27"><div align="center">新聞編號</div></td>
<td width="165"><div align="center">題目</div></td>
<td width="74"><div align="center">詳細類別</div></td>
<td width="74"><div align="center">創建時間</div></td>
<td width="108"><div align="center">操作</div></td>
</tr>
<%
for(int i=start;i<over;i++){
NewsForm form=(NewsForm)list.get(i);
%>
<tr align="center">
<td width="64" height="31"><%=i+1%></td>
<td width="165"><a href="newsAction.do?method=selectOneNewsAction&id=<%=form.getId()%>"><%=form.getTitle()%></a></td>
<td width="77"><%=sortDao.selectSortName(form.getSortId())%></td>
<td width="74"><%=form.getCreateTime()%></td>
<td width="108"><a href="newsAction.do?method=selectOneNewsAction&bigSort=<%=bigSort%>&id=<%=form.getId()%>">修改</a> <a href="javascript:deleteForm('<%=bigSort%>','<%=form.getId()%>')">刪除</a></td>
</tr>
<%}%>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr align="center">
<td width="578" height="27" >
<%for(int i=0;i<pageNumber;i++){%>
<%if(count==i){%>[<font color="#FF0000"><b><%=i+1%></b></font>]
<%}else{%>
[<a href="newsAction.do?method=selectNewsAction&bigSort=<%=bigSort%>&count=<%=i%>"><b><%=i+1%></b></a>]
<%}}%></td>
</tr>
</table>
<%}%> </td>
</tr>
</table>
</div>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -