📄 notelist.jsp
字号:
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="GB2312"%>
<%@page import="java.sql.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<jsp:useBean id="note" scope="page" class="edu.NoteBean" />
<title>公告列表</title>
<link rel="stylesheet" href="style.css" type="text/css">
<style type="text/css">
<!--
.STYLE1 {color: #FFFFFF}
.STYLE2 {color: #FF0000}
-->
</style>
</head>
<body>
<%
int id;
String title="",time="";
int allrow=0,pagesize=10, intpage=1;
try{
intpage=Integer.valueOf(request.getParameter("intpage")).intValue();
}catch(NumberFormatException e){}
ResultSet rs=note.getCount();
if(rs.next())
allrow=rs.getInt(1);
int allpage = (allrow+pagesize-1) / pagesize;
// 调整待显示的页码
if(intpage>allpage) intpage = allpage;
if(intpage<1) intpage = 1;
int startrow=(intpage-1)*pagesize;
note.setStartpage(startrow);
note.setPagesize(pagesize);
%>
<div align="center">
<table width="750" height="25" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="770" height="160"><iframe name="top" height="160"
width="770" scrolling="no" src="top.jsp" frameborder="0"></iframe></td>
</tr>
</table>
</div>
<table width="750" border="0" align="center" cellspacing="1">
<tr bgcolor="#6699CC">
<td width="73%">
<div align="center" class="STYLE1">
<div align="center">公告</div>
</div>
</td>
<td width="27%">
<div align="center"><span class="STYLE1">日期</span></div>
</td>
</tr>
<%
rs = note.getNote();
while(rs.next())
{
id=rs.getInt("id");
title=rs.getString("title");
time=rs.getString("time");
String strtitle="";
if(title.length()>30)
strtitle=title.substring(0,30)+"...";
else strtitle=title;
%>
<tr>
<td bgcolor="#FFFFFF"><a href=shownh.jsp?sort=note&id=<%=id%>
title="<%=title %>"><%=strtitle %></a></td>
<td bgcolor="#FFFFFF"><%=time %></td>
</tr>
<%
}
%></table>
<div align="center">
<table width="750" border="0">
<tr>
<td width="30%" height="30" >
<div align="center">共<span class="STYLE2"><%=allrow %></span>条记录 当前第<span class="STYLE2"><%=intpage %></span>页/共<span class="STYLE2"><%=allpage %></span>页</div></td>
<td width="70%"><div align="center"><a href="notelist.jsp">首页 </a>
<%int tenpage=((int)(intpage/10))*10;
if(intpage-10>0) {%>
<a
href="notelist.jsp?intpage=<%=intpage-10%>">上十页</a>
<%} %>
<a
href="notelist.jsp?intpage=<%=intpage-1%>">上一页</a>
<%if(tenpage+10<=allpage){
for(int i=1;i<=10;i++){%>
<a href="notelist.jsp?intpage=<%=tenpage+i %>"><%=tenpage+i %></a>
<%}}if(tenpage+10>allpage){
for(int i=1;i+tenpage<=allpage;i++){%>
<a href="notelist.jsp?intpage=<%=tenpage+i %>"><%=tenpage+i %></a>
<%}} %>
<a
href="notelist.jsp?intpage=<%=intpage+1%>">下一页</a>
<%if(intpage+10<=allpage) {%>
<a
href="notelist.jsp?intpage=<%=intpage+10%>">下十页</a>
<%} %>
<a
href="notelist.jsp?intpage=<%=allpage%>">尾页</a></div></td>
</tr>
</table></div>
<div align="center">
<table height="155" width="750" border="0" cellspacing="1"
align="center">
<tr>
<td><iframe name="bottom" height="155" width="750" scrolling="no"
src="bottom.jsp" frameborder="0"></iframe></td>
</tr>
</table>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -