gz_cx_bm.jsp
来自「JSP页面和oracle9i数据库的源代码」· JSP 代码 · 共 273 行 · 第 1/2 页
JSP
273 行
<%@ 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">
<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/BK042.GIF);
}
-->
</style>
</head>
<body>
<jsp:useBean id="conn" scope="page" class="beans1.conn"/>
<div align="center">按部门查询人员工资页面
<%try{
String page_type=(String)session.getAttribute("page_type");
String page_name=(String)session.getAttribute("page_name");
//String page_bm=(String)session.getAttribute("page_bm");
ResultSet rs=null;
String condition=null;
if(page_type==null){page_type="";}
if(session.isNew()){response.sendRedirect("../index.jsp");}
else
{
if(page_type.equals("sgz"))
{condition="select * from BM";
rs=conn.executeQuery(condition);
}
else
{response.sendRedirect("../index.jsp");}
}
%>
<%String meb=response.encodeURL("gz_cx_bm.jsp");%>
</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/gz_index.jsp");%>href="<%=meb2%>">返回主菜单</a></div>
</form>
<div align="center">
<%String bm=conn.toChinese(request.getParameter("bm"));
if(bm==null){bm="";}
String pageNO=request.getParameter("pageNO");
if(pageNO==null){pageNO="1";}
int pageNO_c=Integer.parseInt(pageNO);
int all=0;//记录总数
int pagecount=1;//规定每页显示记录的个数
int pageall=0;//逻辑总页数
int i=0;
if(bm.equals("0")){out.print("请您选择部门");}
else
{ condition="select BZGZ.BH from BZGZ,ZGXX where BZGZ.BM='"+bm+"' and BZGZ.BH=ZGXX.BH";
rs=conn.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;}//如果记录总数除以每页的显示个数,余数等于0,那么逻辑页数应为所得的商
else{pageall=all/pagecount+1;}//否则,逻辑页数应为商+1
}
%>
<%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>
<%}%>
</div>
<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 BZGZ.BH,BZGZ.BM,ZGXX.XM,BZGZ.GZ,BZGZ.RGZ,BZGZ.GT,BZGZ.CS,BZGZ.CJ,BZGZ.CZ,BZGZ.JT,BZGZ.JZ,BZGZ.FZ,BZGZ.SYY,BZGZ.ST,BZGZ.BT,BZGZ.KQQ,BZGZ.KBJ,BZGZ.LFDG,BZGZ.LT,BZGZ.FT,BZGZ.ZFT,BZGZ.DWT,BZGZ.GL,BZGZ.ZYB,BZGZ.GWX,BZGZ.BJ,BZGZ.YW,BZGZ.FANGTIE,BZGZ.JIAOTONG,BZGZ.SB,BZGZ.MT,BZGZ.WS,BZGZ.YB,BZGZ.YL,BZGZ.KFZ,BZGZ.KHF,BZGZ.KGJJ,BZGZ.WJ,BZGZ.YE,BZGZ.SL,BZGZ.QT,BZGZ.BX,BZGZ.LQ,BZGZ.JCNY from BZGZ,ZGXX where BZGZ.BM='"+bm+"' and BZGZ.BH=ZGXX.BH";
//out.print(condition);
rs=conn.executeQuery(condition);
for(i=0;i<(pageNO_c-1)*pagecount;i++){rs.next();}//规定RS记录指针的位置
for(i=0;i<pagecount;i++)//循环显示
{ if(!rs.next()){break;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?