📄 10-3.txt
字号:
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>成绩查询登录</title>
</head>
<body>
<div align="center">
<center>
<%@ page import="java.sql.*" %>
<%-- 获取表单参数 --%>
<%
int n;
String getname=new String();
String getpassword=new String();
getname=request.getParameter("inputname");
getpassword=request.getParameter("inputpassword");
n=getname.length()*getpassword.length();
%>
<%-- 判断用户的输入是否缺项 --%>
<%
if(n==0){
%>
<p>请输入完整的用户名和口令</p>
<p><a href="../index.html">返回</a></p>
<%
}else{
String no=new String();
String name=new String();
String sex=new String();
String age=new String();
String getclass=new String();
String english=new String();
String chinese=new String();
String math=new String();
String physics=new String();
String chemics=new String();
String sum=new String();
String order=new String();
String url=new String();
String sql=new String();
String errorcode=new String();
url="jdbc:odbc:student";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection(url);
Statement stat=conn.createStatement();
%>
<%-- 验证用户是否存在且口令正确 --%>
<%
try{
sql="select no,sex,age,class from db2admin.profiles where name='"+getname+"' and password='"+getpassword+"' ";
//out.println("<BR>查询用户语句:"+sql);
ResultSet rs1=stat.executeQuery(sql);
if(rs1.next()){
no=rs1.getString("no");
sex=rs1.getString("sex");
age=rs1.getString("age");
getclass=rs1.getString("class");
rs1.close();
%>
<%-- 根据得到的no查询scores表中的学生成绩 --%>
<p align="center"><b><font face="幼圆" size="5" color="blue">成绩查询结果 </font></b></p>
<hr>
<%
sql="select * from db2admin.scores where no='"+no+"'";
//out.println("<BR>查询成绩语句:"+sql);
ResultSet rs2=stat.executeQuery(sql);
if(rs2.next()){
english=rs2.getString("english");
chinese=rs2.getString("chinese");
math=rs2.getString("math");
physics=rs2.getString("physics");
chemics=rs2.getString("chemics");
sum=rs2.getString("sum");
order=rs2.getString("order");
}
rs2.close();
%>
<table border="1" width="300" cellspacing="1">
<tr>
<td width="290" colspan="4">
<p align="center"><b><font size="4">学生基本信息</font></b></td>
</tr>
<tr>
<td width="55" align="right"><b><font color="#00FFFF">姓 名</font></b></td>
<td width="95"><%=getname%></td>
<td width="54" align="right"><b><font color="#00FFFF">学 号</font></b></td>
<td width="68"><%=no%></td>
</tr>
<tr>
<td width="55" align="right"><b><font color="#00FFFF">性 别</font></b></td>
<td width="95"><%=sex%></td>
<td width="54" align="right"><b><font color="#00FFFF">年 龄</font></b></td>
<td width="68"><%=age%></td>
</tr>
<tr>
<td width="55" align="right"><b><font color="#00FFFF">班 级</font></b></td>
<td width="217" colspan="3"><%=getclass%></td>
</tr>
</table>
</center>
</div>
<br>
<div align="center">
<center>
<table border="1" width="400" cellspacing="1" height="90">
<tr>
<td width="100%" colspan="6" height="18">
<p align="center"><b><font size="4">学生成绩单</font></b></td>
</tr>
<tr>
<td width="16%" align="right" height="16"><font color="#00FFFF">英
语</font></td>
<td width="16%" height="16"><%=english%></td>
<td width="17%" height="16" align="right"><font color="#00FFFF">语
文</font></td>
<td width="17%" height="16"><%=chinese%></td>
<td width="17%" height="16" align="right"><font color="#00FFFF">数
学</font></td>
<td width="17%" height="16"><%=math%></td>
</tr>
<tr>
<td width="16%" align="right" height="16"><font color="#00FFFF">物
理</font></td>
<td width="16%" height="16"><%=physics%></td>
<td width="17%" height="16" align="right"><font color="#00FFFF">化
学</font></td>
<td width="51%" height="16" colspan="3"><%=chemics%></td>
</tr>
<tr>
<td width="16%" align="right" height="16"><font color="#00FFFF">总 分</font></td>
<td width="33%" height="16" colspan="2"><%=sum%></td>
<td width="17%" height="16"><font color="#00FFFF">排 名</font></td>
</center>
<td width="34%" height="16" align="right" colspan="2">
<p align="left"><%=order%></td>
</tr>
</table>
</div>
<p align="left"> </p>
<p align="center"> </p>
<%}else{%>
<p>请输入正确的姓名和口令<p>
<p><a href="../student.html">返回</a></p>
<%}
}catch(Exception e){
errorcode=e.toString();
out.println("<BR>错误信息:"+errorcode);
}finally{
stat.close();
conn.close();
}
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -