📄 editnews.jsp
字号:
<%@ page contentType="text/html; charset=GBK"%>
<%@ page language="java" import="java.util.*,popten.web.*,popten.util.GetSession" %>
<%@ page errorPage="error.jsp" %>
<%@ include file="chelogin3.jsp"%>
<%
GetSession sess001 = new GetSession();
Admin user001 = sess001.getAdminSession(session);
int clas=Integer.parseInt(user001.getclas());
String str=null;
str=(request.getParameter("action")!=null && request.getParameter("action").equals("coun"))?"coun":"dat";
if(request.getParameter("act")!=null && request.getParameter("act").equals("1")){
News news = new News();
Vector newsList = new Vector();
newsList = news.loadAll(str);
session.setAttribute("newsList",newsList);
}
//分页开始
int pagenum;//显示的页数
int pagesize;//一页显示的行数
int pagecoun;//总页数
int rowcoun;//总的记录数
String strPage = request.getParameter("pagenum");
if(strPage==null){//表明在QueryString中没有page这一个参数,此时显示第一页数据
pagenum = 0;
}
else{//将字符串转换成整型
pagenum = Integer.parseInt(strPage);
if(pagenum<1) pagenum = 0;
}
Vector newsListB=(Vector)session.getAttribute("newsList");
pagesize=20;
rowcoun=newsListB.size();
pagecoun=(rowcoun+pagesize-1) / pagesize;
int stopage=pagenum+20;//本页的最后一条记录
if(stopage>rowcoun)stopage=rowcoun;
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>POPTEN</title>
<link rel="stylesheet" type="text/css" href="../style/style.css">
</head>
<body>
<center>
<br>
<br>
<br>
<%@ include file="search.jsp"%>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="560" bgcolor="#f2f8ff">
<tr>
<td width="15" class="td4">
<img border="0" src="../img/null.gif"></td>
<th width="525" class="td5"><%News newsall= (News)newsListB.elementAt(0);%>
<img border="0" src="../img/null.gif">修改资料</th>
<td width="20" class="td6">
<img border="0" src="../img/jiao3.gif"></td>
</tr>
<tr>
<td width="100%" colspan="3" class="td7" valign="top" align="center">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="98%" bordercolor="#DEEEFF">
<tr>
<th width="36%">
<p align="center">标题</th>
<th width="32%"><p align="center"><a href="editnews.jsp?pagenum=<%=pagenum%>&act=1">日期</a></th>
<th width="32%">
<p align="center"><a href="editnews.jsp?action=coun&pagenum=<%=pagenum%>&act=1">浏览次数</a></th>
</tr>
<%for(int i=pagenum;i<stopage;i++){
newsall= (News)newsListB.elementAt(i);
%>
<tr onmouseover="this.bgColor='#deeeff';" onmouseout="this.bgColor='#f2f8ff';">
<td width="36%"><a href="news.jsp?news_id=<%=newsall.getnews_id()%>"><%=newsall.getnews_title()%></a></td>
<td width="32%"><p align="center"><font color=#808080><%=newsall.getdat()%></font></td>
<td width="32%"><p align="center"><font color=#808080>[<%=newsall.getcoun()%>]</font> <a href="editnews1.jsp?news_id=<%=newsall.getnews_id()%>">编辑</a> <%if(clas<=2){%><a href="addok.jsp?news_id=<%=newsall.getnews_id()%>&cata2_id=<%=newsall.getcata2_id()%>&cata1_id=<%=newsall.getcata1_id()%>&cata0_id=<%=newsall.getcata0_id()%>&news_title=<%=newsall.getnews_title()%>&action=del">删除</a><%}%></td>
</tr>
<%}%>
<tr>
<td width="100%" colspan="3"><p align="right">共 <%=pagecoun%> 页
<%if(pagenum!=0){out.println("<a href='editnews.jsp?pagenum="+(pagenum-20)+"'>上一页</a>");}
for(int j=0;j<pagecoun;j++){
if(j*20==pagenum){
out.println("["+(j+1)+"]");
}
else{
out.println("<a href='editnews.jsp?pagenum="+j*20+"'>"+(j+1)+"</a>");
}
}
if(pagenum<20*(pagecoun-1)){out.println("<a href='editnews.jsp?pagenum="+(pagenum+20)+"'>下一页</a> ");}
%></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15">
<img border="0" src="../img/jao5.gif"></td>
<td width="525" class="td8">
<img border="0" src="../img/null.gif"></td>
<td width="20" class="td9">
<img border="0" src="../img/null.gif"></td>
</tr>
</table></td>
</tr>
</table>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -