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

📄 notice_management.jsp

📁 jsp动态网站开发技术与实践 电子工业出版社 随书附赠源代码
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
		<link rel=stylesheet type=text/css href="../lib/enterprise.css">
		<title>欢迎光临企业办公平台</title>
		<jsp:useBean scope="page" id="Notice" class="com.chapter15.Notice" />
		<jsp:useBean scope="page" id="pages" class="com.chapter15.SplitPage" />
		<jsp:useBean scope="page" id="User" class="com.chapter15.User" />
	</head>
	<%

	//获取所有公告信息
	ResultSet rs = Notice.show_notices();
	//初始化分页显示类
	pages.initialize(rs,10);
	String strPage=null;
	int showPage = 1;
	//获取跳转到的目的页面
	strPage=request.getParameter("showPage");
	if (strPage==null)
	{
		showPage=1;
	}
	else
	{
		try
		{
			showPage=Integer.parseInt(strPage);
		}
		catch(NumberFormatException e)
		{
			showPage = 1;
		}
		if(showPage<1) 
		{
			showPage=1;
		}
		if(showPage>pages.getPageCount()) 
		{
			showPage=pages.getPageCount();
		}
	}	
	//获取要显示的数据集合
	Vector vData=pages.getPage(showPage);	
%>
	<body bgcolor="#F2F2F2">
		<div align="center">
		<form name="form1" method="post" action="delete_notice.jsp" target="_self">
		<input type="hidden" name="showPage" value="<%=showPage%>">
		<table width="95%" border="0" cellpadding="0" cellspacing="1">
			<tr bgcolor="#CC99FF">
			<th width="10%" height="30" align="center">选中</th>
			<th width="10%" height="30" align="center">编号</th>
			<th width="30%" height="30" align="center">公告标题</th>
			<th width="25%" height="30" align="center">发布时间</th>
			<th width="15%" height="30" align="center">发布人</th>
			<th width="10%" height="30" align="center">修改</th>
			</tr>
		<%			
			//循环显示当前页的公告信息
			for(int i=0;i<vData.size();i++)
			{ 
				//显示数据
				String[] sData=(String[])vData.get(i);
				long lUserID = Long.parseLong(sData[5]);
				//获取当前所要显示公告的公告类别信息
				User.setUserID(lUserID);
				User.init();
				
		%>
				<tr>
					<td width="10%" height="25" align="center">&nbsp;<input type="checkbox" name="DeleteID" value="<%=sData[0]%>"></td>
					<td width="10%" height="25" align="center"><b><%=sData[0]%></b></td>
					<td width="30%" height="25" align="left">&nbsp;<a href="../notice_detail.jsp?NoticeID=<%=sData[0]%>" target="_self"><font color="#0000FF"><%=sData[1]%></font></a></td>
					<td width="25%" height="25" align="left">&nbsp;<%=sData[6]%></td>
					<td width="15%" height="25" align="left">&nbsp;<%=User.getRealName()%></td>
					<td width="10%" height="25" align="center">&nbsp;<a href="modify_notice_form.jsp?NoticeID=<%=sData[0]%>&showPage=<%=showPage%>" target="_self"><font color="#0000FF">修改</font></a></td>
		
				</tr>
		<%
				
			}
		%>
		</table>
		<p><input type="submit" name="sub" value="删除选中的公告">&nbsp;&nbsp;
		<input type="button" name="btn" value="发布新公告" onClick="javascript:window.location='add_notice_form.html'">
		</p>
		</form>
		<p>
		<form action="notice_management.jsp" method="post" target="_self">	
			第<font color="#FF0000"><%=showPage%></font>页/共<font color=red><%=pages.getPageCount()%></font>页&nbsp;
			<a href="notice_management.jsp?showPage=1" target="_self"><font color="#0000FF">[首页]</font></a>&nbsp;			
			<%
				//判断"上一页"链接是否要显示
				if(showPage > 1)
				{				
			%>
					<a href="notice_management.jsp?showPage=<%=showPage-1%>" target="_self"><font color="#0000FF">[上一页]</font> </a>&nbsp;
			<%
				}
				else
				{
					out.println("[上一页]&nbsp;");
				}
				//判断"下一页"链接是否要显示
				if(showPage < pages.getPageCount())
				{				
			%>
					<a href="notice_management.jsp?showPage=<%=showPage+1%>" target="_self"><font color="#0000FF">[下一页]</font> </a>&nbsp;
			<%
				}
				else
				{
					out.println("[下一页]&nbsp;");
				}
			%> 
			<a href="notice_management.jsp?showPage=<%=pages.getPageCount()%>" target="_self"><font color="#0000FF">[尾页]</font> </a>&nbsp;
			转到
			<select name="showPage">
			<%
				for(int x=1;x<=pages.getPageCount();x++)
				{
			%>
					<option value="<%=x%>" <%if(showPage==x) out.println("selected");%> ><%=x%></option>
			<%
				}
			%>
			</select>
			页&nbsp;
			<input type="submit" name="go" value="提交"/>
		</form>
		</p>
		<%rs.close();%>
	</div>
	</body>
</html>

⌨️ 快捷键说明

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