📄 college.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.sql.*" %>
<%@ page import="DataBaseConnection.OracleConnection" %>
<html>
<body bgcolor=cyan>
<center>
<font size=7>
<HEAD>
<TITLE>院校信息</TITLE>
</HEAD>
<%--对获取的编号进行判断和处理--%>
<%
//如果为空就转回去
String a="";
boolean check=true;
String bh = request.getParameter( "DH" );
String mm =request.getParameter("MM");
if( bh==null||bh.trim().equals( "" ) ){
%>
<jsp:forward page ="login.jsp"/>
<%
}
if( mm==null||mm.trim().equals( "" ) ){
%>
<jsp:forward page ="login.jsp"/>
<%
}
//如果count不是数字就转回去
int number;
try{
number = Integer.parseInt( bh );
}catch( Exception e ) {
%>
<jsp:forward page ="login.jsp"/>
<% }
%>
<%
//获取连接对象和语句对象
Connection conn = null;
Statement stmt = null;
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 ){
check=false;
out.print( "不存在此院校!" );
}
else{
rs = stmt.executeQuery( "select count(*) from college where 院校编号= '"+bh+"' and 密码='"+mm+"'" );
rs.next();
if( rs.getInt(1) == 0 ){
check=false;
out.print( "密码出错!请重新登录!" );
}
//若存在则输出他的相关信息
else{
String sql = "select 院校名称 from college where 院校编号= '"+bh+"' ";
rs = stmt.executeQuery( sql );
rs.next();
out.print( rs.getString(1) );
%>
<br> <font size=+3> 录取名单</font>
<table border="1">
<tr bgcolor="#FFCC99">
<th nowrap>编号</th>
<th nowrap>姓名</th>
<th nowrap>性别</th>
<th nowrap>总分</th>
<th nowrap>同意调剂</th>
<th nowrap>一志愿</th>
<th nowrap>二志愿</th>
<th nowrap>录取志愿</th>
<th nowrap>操作人</th>
</tr>
<%
sql = "select * from student where 录取院校='"+bh+"' order by 编号";
rs = stmt.executeQuery( sql );
while( rs.next() ){
if(rs.getString(3).equals("1")){a="男";}
if(rs.getString(3).equals("2")){a="女";}
out.print( "<tr> <td>"+rs.getString(1)+"</td><td>"+
rs.getString(2)+"</td><td>"+a+"</td><td>"+rs.getString(5)+
"</td><td>"+rs.getString(6)+"</td><td>"+rs.getString(7)+
"</td><td>"+rs.getString(8)+
"</td><td>"+rs.getString(10)+
"</td><td>"+rs.getString(13)+"</td></tr>" );
}
}
}
%></table><%
if(check){ %>
<form action="CheckScore1.jsp" method="post">
<br>查询考生各科成绩:
<br><input type="text" name="hm">
<input type="hidden" name="bh" value="<%=bh%>">
<input type="hidden" name="mm" value="<%=mm%>">
<input type="submit" value="查询">
</form>
<%
}
%>
<p><a href="login.jsp">退出</a></p>
</font>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -