?? notice.jsp
字號(hào):
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<jsp:useBean id="pagecount" class="oabean.pageInfo" scope="page" />
<jsp:useBean id="getPages" class="oabean.pages" scope="page" />
<jsp:useBean id="date" class="oabean.date" scope="page" />
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>show worker info</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css" media="all">
@import "admin/Upimg/thickbox.css";
@import "css/pages.css";
</style>
<script src="admin/Upimg/jquery-1.1.3.1.pack.js" type="text/javascript"></script>
<script src="admin/Upimg/thickbox-compressed.js" type="text/javascript"></script>
<script src="admin/Upimg/global.js" type="text/javascript"></script>
<script type="text/javascript" src="/oa/js/popcalendar.js"></script>
<script language="javascript">
function sty()
{
document.getElementById("add").style.textDecoration="underline";
}
function out()
{
document.getElementById("add").style.textDecoration="blink";
}
</script>
</head>
<body>
<%
String uname=(String)session.getAttribute("user");
if(uname==null) {response.sendRedirect("../index.jsp");}
int pageNow=1;//初始頁
int pageSize=4;//一頁顯示多少條記錄
String s="";
String pagenow=request.getParameter("pageNow");//接收頁碼
//下面是獲取當(dāng)前要顯示的是重要還是普通的公告
String sel1=request.getParameter("select1");
String sel2=request.getParameter("select2");
String dat=request.getParameter("ndate");
if(pagenow!=null&&pagenow!="")
{
pageNow=Integer.parseInt(pagenow);
}
String sql= "select top "+pageSize+" * from oa_notice where noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice )";
String Countsql="select count(*) from oa_notice";
//這里是只查詢普通還是重要的公告
if((sel1!=null&&sel1!="")&&sel2==""&&dat=="")
{
if(sel1.equals("1"))
{
sql="select top "+pageSize+" * from oa_notice where type='普通' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='普通')";
Countsql="select count(*)from oa_notice where type='普通'";
}
else if(sel1.equals("2"))
{
sql="select top "+pageSize+" * from oa_notice where type='重要' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='重要')";
Countsql="select count(*)from oa_notice where type='重要'";
}
}
//這里是查詢關(guān)于那方面的公告
else if(sel1==""&&(sel2!=null&&sel2!="")&&dat=="")
{
if(sel2.equals("1"))
{
sql="select top "+pageSize+" * from oa_notice where lev='財(cái)務(wù)公告' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where lev='財(cái)務(wù)公告')";
Countsql="select count(*) from oa_notice where lev='財(cái)務(wù)公告'";
}
else if(sel2.equals("2"))
{
sql="select top "+pageSize+" * from oa_notice where lev='人員調(diào)整' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where lev='人員調(diào)整')";
Countsql="select count(*) from oa_notice where lev='人員調(diào)整'";
}
}
//查詢具體時(shí)間的公告
else if(sel1==""&&sel2==""&&dat!="")
{
sql="select top "+pageSize+" * from oa_notice where notime='"+dat+"' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where notime='"+dat+"')";
Countsql="select count(*) from oa_notice where notime='"+dat+"'";
}
//這里是查詢選了lev和type的公告
else if((sel1!=null&&sel1!="")&&(sel2!=null&&sel2!="")&&dat=="")
{
if((sel1.equals("1"))&&(sel2.equals("1")))
{
sql="select top "+pageSize+" * from oa_notice where type='普通' and lev='財(cái)務(wù)公告' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='普通' and lev='財(cái)務(wù)公告')";
Countsql="select count(*) from oa_notice where lev='財(cái)務(wù)公告' and type='普通'";
}
else if((sel1.equals("1"))&&(sel2.equals("2")))
{
sql="select top "+pageSize+" * from oa_notice where type='普通' and lev='人員調(diào)整' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='普通' and lev='人員調(diào)整')";
Countsql="select count(*) from oa_notice where lev='人員調(diào)整' and type='普通'";
}
else if((sel1.equals("2"))&&(sel2.equals("1")))
{
sql="select top "+pageSize+" * from oa_notice where type='重要' and lev='財(cái)務(wù)公告' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='重要' and lev='財(cái)務(wù)公告')";
Countsql="select count(*) from oa_notice where lev='財(cái)務(wù)公告' and type='重要'";
}
else if((sel1.equals("2"))&&(sel2.equals("2")))
{
sql="select top "+pageSize+" * from oa_notice where type='重要' and lev='人員調(diào)整' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='重要' and lev='人員調(diào)整')";
Countsql="select count(*) from oa_notice where lev='人員調(diào)整' and type='重要'";
}
}
//這里是查詢選了lev和type和notime的公告
else if((sel1!=null&&sel1!="")&&(sel2!=null&&sel2!="")&&dat!="" )
{
if((sel1.equals("1"))&&(sel2.equals("1")))
{
sql="select top "+pageSize+" * from oa_notice where type='普通' and lev='財(cái)務(wù)公告' and notime='"+dat+"' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='普通' and lev='財(cái)務(wù)公告' and notime='"+dat+"')";
Countsql="select count(*) from oa_notice where lev='財(cái)務(wù)公告' and type='普通' and notime='"+dat+"'";
}
else if((sel1.equals("1"))&&(sel2.equals("2")))
{
sql="select top "+pageSize+" * from oa_notice where type='普通' and lev='人員調(diào)整' and notime='"+dat+"' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='普通' and lev='人員調(diào)整' and notime='"+dat+"')";
Countsql="select count(*) from oa_notice where lev='人員調(diào)整' and type='普通' and notime='"+dat+"'";
}
else if((sel1.equals("2"))&&(sel2.equals("1")))
{
sql="select top "+pageSize+" * from oa_notice where type='重要' and lev='財(cái)務(wù)公告' and notime='"+dat+"' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='重要' and lev='財(cái)務(wù)公告' and notime='"+dat+"')";
Countsql="select count(*) from oa_notice where lev='財(cái)務(wù)公告' and type='重要' and notime='"+dat+"'";
}
else if((sel1.equals("2"))&&(sel2.equals("2")))
{
sql="select top "+pageSize+" * from oa_notice where type='重要' and lev='人員調(diào)整' and notime='"+dat+"' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='重要' and lev='人員調(diào)整' and notime='"+dat+"')";
Countsql="select count(*) from oa_notice where lev='人員調(diào)整' and type='重要' and notime='"+dat+"'";
}
}
int pageCount=pagecount.getpageCount(Countsql,pageSize);//得到總共有多少頁
int rowCount=pagecount.getrowCount(Countsql);//得到總共有多少條記錄
ArrayList a1=getPages.getNotice(sql);//得到分頁信息
//顯示
%>
<form action="admin/notice.jsp" method="post" name="student">
<table width="100%" class="topList" cellSpacing=1 align="center" border=0>
<tr>
<td align="center" colspan="10"><div align="center" class="STYLE3">
<select name="select1" size="1">
<option value="">請(qǐng)選擇重要程度</option>
<option value="1">普通</option>
<option value="2">重要</option>
</select>
<select name="select2" size="1">
<option value="">請(qǐng)選擇類別</option>
<option value="1">財(cái)務(wù)公告</option>
<option value="2">人員調(diào)整</option>
</select>
<label>日期:</label>
<input id="sdv" name="ndate" onclick="showCalendar(this, this, 'yyyy-mm-dd','cn',1);" maxlength="20" size="10" value=""/>日
<script>
var osdv = document.getElementById('sdv');
if(osdv != null) osdv.readOnly='true';
</script>
<input type="submit" name="ns" value="搜索"></div>
</td>
</tr>
<tr>
<td scope="col"><div align="center" class="STYLE1">公告號(hào)</div></td>
<td scope="col"><div align="center" class="STYLE1">公告類型</div></td>
<td scope="col"><div align="center" class="STYLE1">標(biāo)題</div></td>
<td scope="col"><div align="center" class="STYLE1">公告類別</div></td>
<td scope="col"><div align="center" class="STYLE1">公告時(shí)間</div></td>
<td scope="col" colspan="3"><div align="center" class="STYLE1">操作</div></td>
</tr>
<%
for(int i=0;i<a1.size();i++)
{
//從a1中取出noticeBean
oanoticecrud.noticeBean St=(oanoticecrud.noticeBean)a1.get(i);
%>
<tr>
<% int noid=St.getNoId();%>
<td align="center"><%=St.getNoId()%></td>
<td align="center"><%=St.getLev() %></td>
<td align="center"><a href="admin/noticecontent.jsp?id=<%=noid%>&modal=true" class="thickbox" style="text-decoration:none"><%=St.getTitle()%></td>
<td align="center"><%=St.getType()%></td>
<td align="center"><%=St.getNotime().substring(0,10)%></td>
<td align="center"><img src="images/del.gif"><a href="notice/delnotice.notice?id=<%=noid%>" onclick="return window.confirm('您確認(rèn)要?jiǎng)h除嗎?');" style="text-decoration:none">刪除</a></td>
<td align="center"><img src="images/mod.gif"><a href="admin/modnotice.jsp?id=<%=noid%>&modal=true" class="thickbox" style="text-decoration:none">修改</a></td>
<%
}
%>
<tr>
<td colspan="10">
<ul id="nav">
共有<span class="STYLE2"><%=rowCount%></span>條記錄
<%
out.println("<li><a href=admin/notice.jsp?pageNow=1&&select1="+sel1+"&&select2="+sel2+"&&ndate="+dat+" style='text-decoration:none'>首</a></li>");
if(pageNow!=1)
{
out.println("<li><a href=admin/notice.jsp?pageNow="+(pageNow-1)+"&&select1="+sel1+"&&select2="+sel2+"&&ndate="+dat+" style='text-decoration:none'>«</a></li>");
}
for(int j=1;j<=pageCount;j++)
{
out.println("<li><a href=admin/notice.jsp?pageNow="+j+"&&select1="+sel1+"&&select2="+sel2+"&&ndate="+dat+" style='text-decoration:none'>["+j+"]</a></li>");
}
if(pageNow!=pageCount)
{
out.println("<li><a href=admin/notice.jsp?pageNow="+(pageNow+1)+"&&select1="+sel1+"&&select2="+sel2+"&&ndate="+dat+" style='text-decoration:none'>»</a></li>");
}
out.println("<li><a href=admin/notice.jsp?pageNow="+pageCount+"&&select1="+sel1+"&&select2="+sel2+"&&ndate="+dat+" style='text-decoration:none'>末</a></li>");
%>
<span class="STYLE2"><% out.println(pageNow+"/"+pageCount);%></span>
</ul>
</td>
<td align="left"><img src="images/add.gif"><a href="admin/addnotice.jsp?modal=true" class="thickbox" onmouseover="sty();" onmouseout="out();" style='text-decoration:blink'>增加</a></td>
</tr>
</table>
</form>
<form action="admin/notice.jsp"> 跳轉(zhuǎn)到第<input type="text" name="pageNow" size="8">頁
<input type="hidden" name="select1" value="<%=sel1%>">
<input type="hidden" name="select2" value="<%=sel2%>">
<input type="hidden" name="ndate" value="<%=dat%>">
<input type="submit" value="Go">
</form>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -