?? selfpickinfo.jsp
字號:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.sql.*" %>
<%@ page import="com.sun.rowset.*" %>
<%@ page import="DataBaseConnection.OracleConnection" %>
<%
//如果為空就轉回去
String bh = request.getParameter( "BH" );
if( bh==null||bh.trim().equals( "" ) ){
%>
<jsp:forward page ="PickTaking.jsp"/>
<%
}
//如果count不是數字就轉回去
int number;
try{
number = Integer.parseInt( bh );
}catch( Exception e ) {
%>
<jsp:forward page ="PickTaking.jsp"/>
<% }
%>
<%
Connection conn = null;
Statement stmt = null;
CachedRowSetImpl rowSet;
String user = "sox";
String password = "123";
OracleConnection oc = new OracleConnection( user, password );
try{
conn = oc.getConnection();
stmt = conn.createStatement();
}
catch( SQLException e ){ System.out.println( e.getMessage()+"374" ); }
ResultSet rs = stmt.executeQuery( "select count(*) from college where 院校編號= '"+bh+"' " );
rs.next();
if( rs.getInt(1) == 0 ){
out.print( "<font size=+3>不存在此院校" );
}
else{
String message=request.getParameter("error");
if(message==null){message="";}
else{
if(message.equals("fail0")){message="輸入的考生編號出錯!";}
if(message.equals("fail1")){message="該考生沒有報考我校或已被錄取!";}
if(message.equals("success")){message="成功招收一名考生!";}
}
String sql="select student.編號,student.姓名,score.語文,score.數學,score.英語,score.綜合,score.X科,score.總分 from student,score where student.編號=score.號碼 and student.錄取狀態=0 and (student.一志愿='"+bh+"' or student.二志愿='"+bh+"') order by student.總分 desc";
rs = stmt.executeQuery( sql );
rowSet=new CachedRowSetImpl();
rowSet.populate(rs);
rowSet.last();
int m=rowSet.getRow();
int n=15;
int pageAllCount=((m%n)==0)?(m/n):(m/n+1);
%>
<center>
<br> <font size=+3>考生成績</font>
<table border="1">
<tr bgcolor="#FFCC99">
<th nowrap width=100>編號</th>
<th nowrap width=100>姓名</th>
<th nowrap width=100>語文</th>
<th nowrap width=100>數學</th>
<th nowrap width=100>英語</th>
<th nowrap width=100>綜合</th>
<th nowrap width=100>X科</th>
<th nowrap width=100>總分</th>
</tr>
<%
int pag=1;
String str=request.getParameter("showPage");
if(str==null||str.trim().equals("")){pag=1;}
else{byte b[]=str.getBytes("ISO-8859-1");
str=new String(b);
pag=Integer.parseInt(str);
if (pag<=0){pag=pageAllCount;}
else if(pag>pageAllCount){pag=1;}
else{pag=Integer.parseInt(str);}
}
rowSet.absolute((pag-1)*15+1);
for(int i=1;i<=15;i++)
{
out.print(
"<tr> <td>"+rowSet.getString(1)+"</td><td>"+rowSet.getString(2)+"</td><td>"+rowSet.getString(3)+"</td><td>"+rowSet.getString(4)+
"</td><td>"+rowSet.getString(5)+"</td><td>"+rowSet.getString(6)+"</td><td>"+rowSet.getString(7)+"</td><td>"+rowSet.getString(8)+"</td></tr>"
);
if(rowSet.isLast()){break;}else{rowSet.next();}
}
%>
</table>
<BR>共有<%=m%>條學生信息
<BR>當前顯示第<Font color=blue><%=pag%></Font>頁,
共有<Font color=blue><%=pageAllCount%></Font>頁,
單擊“前一頁”或“下一頁”按鈕查看記錄
<TABLE>
<TR><TD><FORM action="">
<Input type=hidden name="showPage" value="<%=pag-1%>">
<Input type=hidden name="BH" value="<%=bh%>">
<Input type=submit name="g" value="前一頁">
</FORM>
</TD>
<TD><FORM action="">
<Input type=hidden name="showPage" value="<%=pag+1%>">
<Input type=hidden name="BH" value="<%=bh%>">
<Input type=submit name="g" value="后一頁">
</FORM>
</TD>
<TD><FORM action="">
輸入頁碼:<Input type=text name="showPage" size=5>
<Input type=hidden name="BH" value="<%=bh%>">
<Input type=submit name="g" value="提交">
</FORM>
</TD>
</TR>
</TABLE>
<form action="SelfAction.jsp" method="post">
<Input type=hidden name="lqyx" value="<%=bh%>">
<br><font size=+2 color=blue>錄取指定學生:</font>
<br>請輸入學生號碼:<input type="text" name="hm1">
<br>請再次輸入號碼:<input type="text" name="hm2"><Input type=submit value="錄取"></br>
<form>
<p><font size=+2 color=red><%=message%></font>
</center>
<%
}
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -