rs_cx_bm.jsp

来自「JSP页面和oracle9i数据库的源代码」· JSP 代码 · 共 388 行 · 第 1/2 页

JSP
388
字号
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!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">
<%@page import="java.util.Calendar"%>
<title>按部门查询人事档案</title>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
.style2 {
	font-size: 24px;
	color: #FFFFFF;
}
.style4 {font-size: 14px}
.style5 {color: #FFFFFF; font-size: 14px; }
.style6 {font-size: 12px}
body {
	background-image: url(../img/b090.jpg);
}
-->
</style>
</head>

<body>
<div align="center">
按部门查询人事档案页面
  <%@ include file="/commond/conn.jsp"%>
  <%
String page_type=(String)session.getAttribute("page_type");
String page_name=(String)session.getAttribute("page_name");
if(page_type==null){page_type="";}
if(session.isNew()){response.sendRedirect("../index.jsp");}
else
{	if(!(page_type.equals("rs")) && !page_type.equals("srs"))
	{response.sendRedirect("../index.jsp");}	
}
%>
<%String meb=response.encodeURL("rs_cx_bm.jsp");%>
  <%	String condition="select * from BM";
	rs=sql.executeQuery(condition);
%>
</div>
<form name="form1" method="post" action="<%=meb%>">
  <div align="center">
  <select name="bm" id="select">
    <option value="0">请选择按那个部门查询</option>
    <%while(rs.next())
		  	   {%>
    <option value=<%=rs.getString("BM")%>><%=rs.getString("BM")%></option>
    <%}%>
  </select>
  <input type="submit" name="Submit" value="查询">
  <a <%String meb2=response.encodeURL("../index/rs_index.jsp");%>href="<%=meb2%>">返回主菜单</a></div>
</form>
<div align="center">
        <%String bm=request.getParameter("bm");
	   	 if(bm==null){bm="";}
	   	 byte a[]=bm.getBytes("ISO-8859-1");
		 bm=new String(a);	 
		 String pageNO=request.getParameter("pageNO");
		 if(pageNO==null){pageNO="1";}
		 int pageNO_c=Integer.parseInt(pageNO);
		 int all=0,pagecount=1,pageall=0,i=0;
		 if(bm.equals("0")){out.print("请您选择部门");}
		 else
		 {	condition="select * from ZGXX where BM="+"'"+bm+"'";
		 	rs=sql.executeQuery(condition);
			while(rs.next())
			{all++;}
			if(all>0)
			{	out.print("共找到");out.print(all);out.print("条记录");
				if(all<=pagecount){pageall=1;}
				else
				{	int lastcount=0;
					lastcount=all%pagecount;
					if(lastcount==0){pageall=all/pagecount;}
					else{pageall=all/pagecount+1;}
				}
				%>
</div>
				<%if(pageall>1){%>	
				<table width="254" border="0" align="center">
                  <tr>
                    <td width="248">
					<form action="<%=meb%>" method="post">
                      <div align="center">
                        跳转到
                          <select name="pageNO">
                          <%for(i=1;i<=pageall;i++){%>
                          <option value="<%=i%>">第<%=i%>页</option>
                          <%}%>
                        </select>  
                          <input name="确定" type="submit" value="确定">
                        <input name="bm" type="hidden" id="bm" value="<%=bm%>">
                      </div>
					  </form>
					</td>
                  </tr>
  				</table>			  			
        		<%}%>
			    <hr align="center" width="1000">
				<div align="center">第<%=pageNO_c%>页
				  <%if(pageNO_c>1){String page_send=Integer.toString(1);%>
				  <a href="<%=meb%>?pageNO=<%=page_send%>&bm=<%=bm%>">第一页</a>
				  <%}%>
				  <%if(pageNO_c>1){String page_send=Integer.toString(pageNO_c-1);%>
				  <a href="<%=meb%>?pageNO=<%=page_send%>&bm=<%=bm%>">上一页</a>
				  <%}%>			
				  <%if(pageNO_c<pageall){String page_send=Integer.toString(pageNO_c+1);%>
				  <a href="<%=meb%>?pageNO=<%=page_send%>&bm=<%=bm%>">下一页</a>
				  <%}%>
				  <%if(pageNO_c<pageall){String page_send=Integer.toString(pageall);%>
				  <a href="<%=meb%>?pageNO=<%=page_send%>&bm=<%=bm%>">最末页</a>
				  <%}%>
				共<%=pageall%>页
				<%
				condition="select * from ZGXX where BM="+"'"+bm+"'";
		 		rs=sql.executeQuery(condition);
				for(i=0;i<(pageNO_c-1)*pagecount;i++){rs.next();}%>
</div>
				<table border="1" align="center" cellspacing="1" bordercolor="#FF99CC">
			<%	for(i=0;i<pagecount;i++)
				{	if(!rs.next()){break;}
				%>	
                  <tr bgcolor="#FF99CC">
                    <td height="30" colspan="8" nowrap><div align="center" class="style2">职工基本信息表</div></td>
  					</tr>
                  <tr>
                    <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4">
                      <div align="right"><span class="style1">编号:</span></div>
                    </div></td>
                    <td height="20" nowrap><%=rs.getString("BH")%></td>
                    <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4">
                      <div align="right"><span class="style1">姓名:</span></div>
                    </div></td>
                    <td height="20" nowrap><div align="left"><%=rs.getString("XM")%></div></td>
                    <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4">
                      <div align="right"><span class="style1">性别:</span></div>
                    </div></td>
                    <td height="20" nowrap><%=rs.getString("XB")%></td>
                    <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4">
                      <div align="right"><span class="style1">年龄:</span></div>
                    </div></td>
                    <td height="20" nowrap>
					<%	Calendar birthday=Calendar.getInstance();	
						birthday.setTime(rs.getDate("CSNY"));
						Calendar day=Calendar.getInstance();
						int age=0;
						age=day.get(day.YEAR)-birthday.get(birthday.YEAR);
						if(day.get(day.MONTH)<birthday.get(birthday.MONTH)){age--;}
						if(day.get(day.MONTH)==birthday.get(birthday.MONTH))
						{if(day.get(day.DATE)<birthday.get(birthday.DATE)){age--;}}
					%>
					<%=age%></td>
                  </tr>
                  <tr>
                    <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4">
                      <div align="right"><span class="style1">所在部门:</span></div>
                    </div></td>
                    <td height="20" nowrap><%=rs.getString("BM")%></td>
                    <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4">
                      <div align="right"><span class="style1">现任职务:</span></div>
                    </div></td>
                    <td height="20" nowrap><%=rs.getString("XRZW")%></td>
                    <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4">
                      <div align="right"><span class="style1">出生年月:</span></div>
                    </div></td>
                    <td height="20" nowrap><%=rs.getDate("CSNY")%></td>
                    <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4">
                      <div align="right"><span class="style1">民族:</span></div>
                    </div></td>
                    <td height="20" nowrap><%=rs.getString("MZ")%></td>
                  </tr>
                  <tr>
                    <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4">
                      <div align="right"><span class="style1">籍贯:</span></div>
                    </div></td>
                    <td height="20" nowrap><%=rs.getString("JG")%></td>
                    <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4">
                      <div align="right"><span class="style1">政治面目:</span></div>
                    </div></td>
                    <td height="20" nowrap><%=rs.getString("ZZMM")%></td>
                    <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4">
                      <div align="right"><span class="style1">职称:</span></div>
                    </div></td>
                    <td height="20" nowrap><%=rs.getString("ZC")%></td>
                    <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4">
                      <div align="right"><span class="style1">文化程度:</span></div>
                    </div></td>
                    <td height="20" nowrap>
					<%  int xl=rs.getInt("WHCD");
						String condition_xl="select * from XL where XLBH="+"'"+xl+"'";
						ResultSet rs_xl=null;

⌨️ 快捷键说明

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