rs_print_mc.jsp

来自「JSP页面和oracle9i数据库的源代码」· JSP 代码 · 共 93 行

JSP
93
字号
<%@ 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}
.style5 {color: #FFFFFF; font-size: 12px; }
.style6 {font-size: 12px}
body {
	background-image: url(../img/allbg.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");}	
}
%>
</div>
<jsp:useBean id="conn" scope="page" class="beans.conn"/>

<div align="center">
   <%     
   		  int all=0;
          String newcondition=null;
		  newcondition="select * from ZGXX";
		  conn.setcondition(newcondition);
		  ResultSet rs=conn.getrs();
		  while(rs.next())
		  {all++;}
		  if(all==0){out.print("职工信息库中无记录!");}
          else{ rs.beforeFirst();
		        while(!rs.isAfterLast())
		             {
		%>
</div>
<table width="100%" height="1000"  border="0">
<tr>
<td valign="top">
    <table border="1" align="center" cellspacing="1" bordercolor="#FF99CC">
<%
for(int i=0;i<37;i++){
if(!rs.next()){break;}
%>
  
        <tr valign="top">
          <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4"><span class="style1">编号:</span></div></td>
          <td height="20" nowrap><%=rs.getString("BH")%></td>
          <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4"><span class="style1">姓名:</span></div></td>
          <td height="20" nowrap><%=rs.getString("XM")%></td>
          <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4"><span class="style1">性别:</span></div></td>
          <td height="20" nowrap><%=rs.getString("XB")%></td>
          <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4"><span class="style1">年龄:</span></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>
          <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4"><span class="style1">所在部门:</span></div></td>
          <td height="20" nowrap><%=rs.getString("BM")%></td>
          <td height="20" nowrap bgcolor="#FF99CC"><div align="left" class="style4"><span class="style1">现任职务:</span></div></td>
          <td height="20" nowrap><%=rs.getString("XRZW")%></td>
        </tr>    
    <%}%>
	    </table>
</td>
</tr>
</table>
<%}%>	
<script language="javascript">
	window.focus();window.print();
</script>
<%}%>
</body>
</html>

⌨️ 快捷键说明

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