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

📄 notice.jsp

📁 实现了一个OA系统基本的功能
💻 JSP
字号:
<%@ 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");//接收页码
       //下面是获取当前要显示的是重要还是普通的公告
       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='重要'";
	    }
	   }
	   
	   //这里是查询关于那方面的公告
	   else if(sel1==""&&(sel2!=null&&sel2!="")&&dat=="")
	   {
	    if(sel2.equals("1"))
	    {
	    sql="select top "+pageSize+" * from oa_notice where lev='财务公告' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where lev='财务公告')";
	    Countsql="select count(*) from oa_notice where lev='财务公告'";
	    }
	    else if(sel2.equals("2"))
	    {
	    sql="select top "+pageSize+" * from oa_notice where lev='人员调整' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where lev='人员调整')";
        Countsql="select count(*) from oa_notice where lev='人员调整'";
	    }
	   }
	   
	   //查询具体时间的公告
	   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='财务公告' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='普通' and lev='财务公告')";
	    Countsql="select count(*) from oa_notice where lev='财务公告' and type='普通'";
	    }
	    else if((sel1.equals("1"))&&(sel2.equals("2")))
	    {
	    sql="select top "+pageSize+" * from oa_notice where type='普通' and  lev='人员调整' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='普通' and lev='人员调整')";
	    Countsql="select count(*) from oa_notice where lev='人员调整' and type='普通'";
	    }
	    else if((sel1.equals("2"))&&(sel2.equals("1")))
	    {
	    sql="select top "+pageSize+" * from oa_notice where type='重要' and lev='财务公告' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='重要' and lev='财务公告')";
	    Countsql="select count(*) from oa_notice where lev='财务公告' and type='重要'";
	    }
	    else if((sel1.equals("2"))&&(sel2.equals("2")))
	    {
	    sql="select top "+pageSize+" * from oa_notice where type='重要' and lev='人员调整' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='重要' and lev='人员调整')";
	    Countsql="select count(*) from oa_notice where lev='人员调整' 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='财务公告' and notime='"+dat+"' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='普通' and  lev='财务公告' and notime='"+dat+"')";
	    Countsql="select count(*) from oa_notice where lev='财务公告' and type='普通' and notime='"+dat+"'";
	    }
	    else if((sel1.equals("1"))&&(sel2.equals("2")))
	    {
	    sql="select top "+pageSize+" * from oa_notice where type='普通' and  lev='人员调整' and notime='"+dat+"' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='普通' and  lev='人员调整' and notime='"+dat+"')";
	    Countsql="select count(*) from oa_notice where lev='人员调整' and type='普通' and notime='"+dat+"'";
	    }
	    else if((sel1.equals("2"))&&(sel2.equals("1")))
	    {
	    sql="select top "+pageSize+" * from oa_notice where type='重要' and  lev='财务公告' and notime='"+dat+"' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='重要' and  lev='财务公告' and notime='"+dat+"')";
	    Countsql="select count(*) from oa_notice where lev='财务公告' and type='重要' and notime='"+dat+"'";
	    }
	    else if((sel1.equals("2"))&&(sel2.equals("2")))
	    {
	    sql="select top "+pageSize+" * from oa_notice where type='重要' and  lev='人员调整' and notime='"+dat+"' and noId not in(select top "+pageSize*(pageNow-1)+" noId from oa_notice where type='重要' and  lev='人员调整' and notime='"+dat+"')";
	    Countsql="select count(*) from oa_notice where lev='人员调整' 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="">请选择重要程度</option>
		  	<option value="1">普通</option>
		  	<option value="2">重要</option>		 
		   </select>
		   <select name="select2" size="1">
		    <option value="">请选择类别</option>
		    <option value="1">财务公告</option>
		    <option value="2">人员调整</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">公告号</div></td>
	     <td scope="col"><div align="center" class="STYLE1">公告类型</div></td>
	     <td scope="col"><div align="center" class="STYLE1">标题</div></td>
	     <td scope="col"><div align="center" class="STYLE1">公告类别</div></td>
	     <td scope="col"><div align="center" class="STYLE1">公告时间</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('您确认要删除吗?');" 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'>&laquo;</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'>&raquo;</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"> 跳转到第<input type="text" name="pageNow" size="8">页
    &nbsp;&nbsp;
    <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>

⌨️ 快捷键说明

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