📄 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 + -