rs_cx_xm.jsp
来自「JSP页面和oracle9i数据库的源代码」· JSP 代码 · 共 364 行 · 第 1/2 页
JSP
364 行
<%@ 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/028.gif);
}
-->
</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_xm.jsp");%>
</div>
<jsp:useBean id="conn" scope="page" class="beans.conn"/>
<form name="form1" method="post" action="<%=meb%>">
<div align="center">
请输入职工姓名:
<input name="xm" type="text" id="xm" size="20" maxlength="8">
<input type="submit" name="Submit" value="查询">
<a <%String meb2=response.encodeURL("../index/rs_index.jsp");%>href="<%=meb2%>">返回主菜单</a>
</div>
</form>
<div align="center">
<%
String xm=request.getParameter("xm");
if(xm==null){xm="";}
byte a[]=xm.getBytes("ISO-8859-1");
xm=new String(a);
if(xm.equals("")){out.print("请输入所要查询的职工姓名!");}
else
{ String newcondition=null;
newcondition="select * from ZGXX where XM LIKE "+"'"+"%"+xm+"%"+"'";
conn.setcondition(newcondition);
ResultSet rs=conn.getrs();
int all=0;
rs.last();
all=rs.getRow();
if(all==0){out.print("没有找到姓名中包含"+'"');out.print(xm);out.print('"'+"字的职工及其信息");}
else
{ if(all<0){out.print("系统出现错误请重新开启网页,如有疑问请与网站开发商联系!");}
else
{ out.print("找到姓名中包含"+'"');out.print(xm);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>
<div align="center">
第<%=pageNO_c%>页
<%if(pageNO_c>1){String page_send=Integer.toString(1);%>
<a href="<%=meb%>?pageNO=<%=page_send%>&xm=<%=xm%>">第一页</a>
<%}%>
<%if(pageNO_c>1){String page_send=Integer.toString(pageNO_c-1);%>
<a href="<%=meb%>?pageNO=<%=page_send%>&xm=<%=xm%>">上一页</a>
<%}%>
<%if(pageNO_c<pageall){String page_send=Integer.toString(pageNO_c+1);%>
<a href="<%=meb%>?pageNO=<%=page_send%>&xm=<%=xm%>">下一页</a>
<%}%>
<%if(pageNO_c<pageall){String page_send=Integer.toString(pageall);%>
<a href="<%=meb%>?pageNO=<%=page_send%>&xm=<%=xm%>">最末页</a>
<%}%>
共<%=pageall%>页
</div>
<hr align="center" width="1000">
<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>
<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">
<% int xl=rs.getInt("WHCD");
String condition_xl="select * from XL where XLBH="+"'"+xl+"'";
conn.setcondition(condition_xl);
ResultSet rs_xl=conn.getrs();
rs_xl.next();
%>
<%=rs_xl.getString("XLMC")%></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>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?