📄 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 + -