📄 cata2.jsp
字号:
<%@ page contentType="text/html; charset=GBK"%>
<%@ page language="java" import="java.util.*,popten.web.*" %>
<%@ page errorPage="error.jsp" %>
<%
String str=null;
str=(request.getParameter("action")!=null && request.getParameter("action").equals("coun"))?"coun":"dat";
if(request.getParameter("cata2_id")!=null && !request.getParameter("cata2_id").equals("")){
session.putValue("cata2_id",request.getParameter("cata2_id"));
session.putValue("title",request.getParameter("cata2_name"));
}
if(request.getParameter("act")!=null && request.getParameter("act").equals("1")){
String cata2_id=(String)session.getValue("cata2_id");
News news = new News();
Vector newsList = new Vector();
newsList = news.loadCata2News(cata2_id,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>
<%@ include file="head.jsp"%>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bgcolor="#ffffff" width="760" >
<tbody>
<tr>
<td width="200" valign="top"><%@ include file="left.jsp"%></td>
<td width="560" valign="top">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="560" bgcolor="#f2f8ff" height="100%">
<tr>
<td width="15" class="td4">
<img border="0" src="img/null.gif"></td>
<td width="525" class="td5"><%if(rowcoun>0){news=(News)newsListB.elementAt(0);%>
<img border="0" src="img/null.gif">当前位置:<a href="index.jsp">网站首页</a> >> <a href="cata1.jsp?cata0_id=<%=news.getcata0_id()%>&cata0_name=<%=news.getcata0_name()%>"><%=news.getcata0_name()%></a> >> <a href="cata1.jsp?cata0_id=<%=news.getcata0_id()%>&cata0_name=<%=news.getcata0_name()%>"><%=news.getcata1_name()%></a> >> <%=news.getcata2_name()%><%}%></td>
<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="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="98%">
<tr>
<th width="36%">
<p align="center">标题</th>
<th width="32%"><p align="center"><a href="cata2.jsp?pagenum=<%=pagenum%>&act=1">日期</a></th>
<th width="32%">
<p align="center"><a href="cata2.jsp?action=coun&pagenum=<%=pagenum%>&act=1">浏览次数</a></th>
</tr>
<%if(rowcoun>0){
for(int i=pagenum;i<stopage;i++){
news= (News)newsListB.elementAt(i);
%>
<tr>
<td width="36%"><a href="news.jsp?news_id=<%=news.getnews_id()%>"><%=news.getnews_title()%></a></td>
<td width="32%"><p align="center"><font color=#808080><%=news.getdat()%></font></td>
<td width="32%"><p align="center"><font color=#808080>[<%=news.getcoun()%>]</font></td>
</tr>
<%}}%>
<tr>
<td width="100%" colspan="3"><p align="right">共 <%=pagecoun%> 页
<%if(pagenum!=0){out.println("<a href='cata2.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='cata2.jsp?pagenum="+j*20+"'>"+(j+1)+"</a>");
}
}
if(pagenum<20*(pagecoun-1)){out.println("<a href='cata2.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>
</tbody>
</table>
<%@ include file="foot.htm"%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -