📄 复件 index.jsp
字号:
<%@ page contentType="text/html; charset=GBK"%>
<%@ page language="java" import="java.util.*,hymn.web.*" %>
<%@ page errorPage="../error.jsp" %>
<%
String str=null;
str=request.getParameter("typeid");
News news = new News();
Vector newsList = new Vector();
newsList = news.loadAll(str);
News newsall= (News)newsList.elementAt(0);
//分页开始
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;
}
pagesize=20;
rowcoun=newsList.size();
if (rowcoun==0)
{
String s="此栏目当前没有信息!";
throw new Exception(s);
}
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>hymn</title>
<link rel="stylesheet" type="text/css" href="../images/style.css">
</head>
<body>
<center>
<br>
<br>
<br>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="98%" bgcolor="#f2f8ff">
<tr>
<td width="15" class="td4">
<th width="525" class="td5">
<font color="#0099FF"><B><%=news.getdescription(str)%></B></font></th>
<td width="20" class="td6">
</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">日期</th>
<th width="32%">
<p align="center">浏览次数</th>
</tr>
<%for(int i=pagenum;i<stopage;i++){
newsall=(News)newsList.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.getnews_pdate()%></font></td>
<td width="32%"><p align="center"><font color=#808080>[<%=newsall.getnews_hit()%>]</font> <a href="editnews1.jsp?news_id=<%=newsall.getnews_id()%>">编辑</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>
</table></td>
</tr>
</table>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -