rs_cx_zc.jsp

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

JSP
405
字号
<%@ 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/0983.jpg);
}
-->
</style>
</head>
<body>
<div align="center">按职称查询人事档案页面
<%
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_zc.jsp");%>
</div>
<jsp:useBean id="conn" scope="page" class="beans.conn"/>
<%String trypage="";
  trypage=conn.setcondition(trypage);
  if(trypage.equals("数据库连接成功"))
  {
%>
<%	
String con="select * from ZC";
conn.setcondition(con);
ResultSet rs=null;
rs=conn.getrs();
if(rs==null){out.print("由于程序错误导致查询失败,请于网管联系!");}
else
{	
%>
<form name="form1" method="post" action="<%=meb%>">
  <div align="center">
    请选择职称:
    <select name="zc" id="select">
    <option value="--未选择职称--">--未选择职称--</option>
    <%while(rs.next())
	{%>
    <option value=<%=rs.getString("zc")%>><%=rs.getString("zc")%></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 zc=request.getParameter("zc");
if(zc==null){zc="";}
conn.setcondition(zc);
zc=conn.toChinese();
if(zc.equals("--未选择职称--")){out.print("请选择职称!");}
else
{	String newcondition=null;
	newcondition="select * from ZGXX where ZC="+"'"+zc+"'";
	conn.setcondition(newcondition);
	rs=conn.getrs();
	int all=0;
	rs.last();
	all=rs.getRow();
	if(all==0){if(!zc.equals("")){out.print("没有找到职称为"+'"');out.print(zc);out.print('"'+"的职工及其信息");}}
	else
	{	if(all<0){out.print("系统出现错误请重新开启网页,如有疑问请与网站开发商联系!");}
		else
		{	out.print("找到职称为"+'"');out.print(zc);out.print('"'+"的职工及其信息共");out.print(all);out.print("条");
			String pageNO=request.getParameter("pageNO");
			if(pageNO==null){pageNO="1";}
			int pageNO_c=Integer.parseInt(pageNO);
			int pagecount=1,pageall=0,i=0;
			if(all<=pagecount){pageall=1;}
			else
			{	int lastcount=0;
				lastcount=all%pagecount;
				if(lastcount==0){pageall=all/pagecount;}
				else{pageall=all/pagecount+1;}
			}
			rs.beforeFirst();
			for(i=0;i<(pageNO_c-1)*pagecount;i++){rs.next();}
			%>
</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="zc" type="hidden" id="zc" value="<%=zc%>">
                      </div>
					  </form>
					</td>
                  </tr>
  				</table>			  			
        		<%}%>
			<div align="center">
			第<%=pageNO_c%>页
			<%if(pageNO_c>1){String page_send=Integer.toString(1);%>
			<a href="<%=meb%>?pageNO=<%=page_send%>&zc=<%=zc%>">第一页</a>
			<%}%>
			<%if(pageNO_c>1){String page_send=Integer.toString(pageNO_c-1);%>
			<a href="<%=meb%>?pageNO=<%=page_send%>&zc=<%=zc%>">上一页</a>
			<%}%>			
			<%if(pageNO_c<pageall){String page_send=Integer.toString(pageNO_c+1);%>
			<a href="<%=meb%>?pageNO=<%=page_send%>&zc=<%=zc%>">下一页</a>
			<%}%>
			<%if(pageNO_c<pageall){String page_send=Integer.toString(pageall);%>
			<a href="<%=meb%>?pageNO=<%=page_send%>&zc=<%=zc%>">最末页</a>
			<%}%>
			共<%=pageall%>页
			</div>
			<hr align="center" width="90%">
			<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><div align="left"><%=rs.getString("BH")%></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><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><div align="left"><%=rs.getString("XB")%></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>
					  <div align="left">
				        <%	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%></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><div align="left"><%=rs.getString("BM")%></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><div align="left"><%=rs.getString("XRZW")%></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><div align="left"><%=rs.getDate("CSNY")%></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><div align="left"><%=rs.getString("MZ")%></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><div align="left"><%=rs.getString("JG")%></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><div align="left"><%=rs.getString("ZZMM")%></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><div align="left"><%=rs.getString("ZC")%></div></td>

⌨️ 快捷键说明

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