⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getnote.jsp

📁 在线教育平台: 从小学
💻 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>
<script language=JavaScript>
function getconfirm()
{
    if (confirm("您确定要删除吗?"))
    return ture;
    else 
    return false;
} 

</script>
<link rel="stylesheet" href="style.css" type="text/css">
<style type="text/css">
<!--
.STYLE2 {
	color: #FFFFFF;
	font-size: 14px;
	font-weight: bold;
}
.STYLE3 {color: #FF0000}
-->
</style>
</head>
<body>
<%
int id;
String title="",time="";
int allrow=0,pagesize=10, intpage=1;
String sort="";
try{
	sort=session.getAttribute("sort").toString();
}catch(NullPointerException e){}
if(!sort.equals("admin"))
	response.sendRedirect("error_ad.jsp");
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);
%>
<table width="750" height="30" border="0" align="center" cellpadding="0"
	cellspacing="0">
	<tr>
		<td width="250" height="25">&nbsp;</td>
		<td width="250">
		<div align="center"><font size="+2" face="华文行楷">公告管理</font></div>
		</td>
		<td>
		<div align="right"><a href="note.jsp"><strong>添加公告</strong></a></div>
		</td>
	</tr>
</table>
<table width="750" border="0" align="center" cellspacing="1"
	bgcolor="#EBEBEB">
	<tr>
		<td width="415" height="25" bgcolor="#FF9933">
		<div align="center" class="STYLE2">主题</div>
		</td>
		<td width="171" bgcolor="#FF9933">
		<div align="center" class="STYLE2">时间</div>
		</td>
		<td width="68" bgcolor="#FF9933">
		<div align="center" class="STYLE2">修改</div>
		</td>
		<td width="78" bgcolor="#FF9933">
		<div align="center" class="STYLE2">删除</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_ad.jsp?sort=note&id=<%=id%>" title="<%=title %>"><%=strtitle %></a></td>
		<td bgcolor="#FFFFFF"><%=time %></td>
		<td bgcolor="#FFFFFF">
		<div align="center"><a href="modifynote.jsp?id=<%=id%>">修改</a></div>
		</td>
		<td bgcolor="#FFFFFF">
		<div align="center"><a
			href="Servletnote?action=delete&id=<%=id%>"
			onClick="return getconfirm()">删除</a></div>
		</td>
	</tr>
	<%
  }rs.close();
  %>
</table>
<div align="center">
<table width="750" border="0">
	<tr>
	<td width="30%" height="30">
	  <div align="center">共<span class="STYLE3"><%=allrow %></span>条记录 当前第<span class="STYLE3"><%=intpage %></span>页/共<span class="STYLE3"><%=allpage %></span>页</div></td>
		<td width="70%"><div align="center"><a href="getnote.jsp">首页</a>&nbsp;&nbsp;
	      <%
	      int tenpage=((int)(intpage/10))*10;
	     if(intpage-10>0) {%>
		      <a href="getnote.jsp?intpage=<%=intpage-10%>">上十页</a>&nbsp;&nbsp;
	      <%} %>
		      <a href="getnote.jsp?intpage=<%=intpage-1%>">上一页</a>&nbsp;&nbsp;
          <%if(tenpage+10<=allpage){
		  for(int i=1;i<=10;i++){%>
		  <a href="getnote.jsp?intpage=<%=tenpage+i %>"><%=tenpage+i %></a>
	      <%}}if(tenpage+10>allpage){
			  for(int i=1;i+tenpage<=allpage;i++){%>
		  <a href="getnote.jsp?intpage=<%=tenpage+i %>"><%=tenpage+i %></a>&nbsp;&nbsp;
		  <%}} %>
		        <a href="getnote.jsp?intpage=<%=intpage+1%>">下一页</a>&nbsp;&nbsp;
          <%if(intpage+10<=allpage) {%>
		        <a href="getnote.jsp?intpage=<%=intpage+10%>">下十页</a>&nbsp;&nbsp;
          <%} %>
	          <a href="getnote.jsp?intpage=<%=allpage%>">尾页</a></div></td>
	</tr>
</table></div>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -