📄 adminscore2.jsp
字号:
<%@ page language = "java" contentType = "text/html;charset=gb2312"%>
<%@ page import = "java.sql.*" %>
<jsp:useBean id="subject" scope="page" class="wsxk.ConDB"/>
<%! String trans(String chi)
{
String result = null;
byte temp [];
try
{
temp=chi.getBytes("iso-8859-1");
result = new String(temp, "gb2312");
}
catch(Exception e)
{
System.out.println (e.toString());
}
return result;
}
%>
<%
String strSQL1 = "select scoreid from score order by scoreid asc";
ResultSet rs5 = subject.executeQuery(strSQL1);
String MaxID = new String();
int id = 0;
while(rs5.next())
{
id = rs5.getInt("scoreid");
}
/*int k = 0;
for (k = 0; k < 999999; k++)
{
if (id.equals(MaxID.valueOf(k)))
break;
}
++k;
if (k >= 999999)
k = 1;
id = MaxID.valueOf(k);*/
id++;
System.out.println("id" + id);
rs5.close();
%>
<%
String teaname = new String (request.getParameter("select2"));
String stuname = new String (request.getParameter("select"));
String couname = new String (request.getParameter("select3"));
String result = new String (request.getParameter("select5"));
String term = new String (request.getParameter("select4"));
couname=couname.trim();
couname=trans(couname);
System.out.println (couname);
teaname= teaname.trim();
teaname= trans(teaname);
System.out.println (teaname);
stuname = stuname.trim();
stuname = trans(stuname);
System.out.println(stuname);
String teaid = new String();
String couid = new String();
String stuid = new String();
String sql = "select couid,couname from course where couname = '"+couname+"'";
ResultSet rs = subject.executeQuery(sql);
while(rs.next())
{
couid = rs.getString("couid");
}
rs.close();
String sql2= "select teaid,teaname from teacher where teaname = '"+teaname+"'";
ResultSet rs1 = subject.executeQuery(sql2);
while(rs1.next())
{
teaid = rs1.getString("teaid");
}
rs1.close();
String sql3 = "select stuid,stuname from student where stuname = '"+stuname+"'";
ResultSet rs2 = subject.executeQuery(sql3);
while(rs2.next())
{
stuid = rs2.getString("stuid");
}
rs2.close();
System.out.println(couid);
System.out.println(teaid);
System.out.println(stuid);
%>
<% if (result.trim().equals(""))
{response.sendRedirect("adminscoreerr.htm");}
else {String sql4 = "insert into score(scoreid, stuid,teaid, couid,term,result) values(" + id + ",'"+stuid+"','" + teaid + "','" + couid + "','"+term+"','"+result+"')";
subject.executeUpdate(sql4);}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta HTTP-EQUIV=REFRESH CONTENT="10; URL=adminscore.jsp">
<link href="_notes/aaa.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
@import url("_notes/ccc");
body,td,th {
font-size: 12px;
color: #FFFFFF;
font-weight: bold;
}
.style1 {color: #000000}
-->
</style>
</HEAD>
<BODY BGCOLOR=#0D85A6 BACKGROUND="images/bg.gif" >
<div align="center">
<p align="left"> <br>
学生成绩录入成功,本页将于10秒内自动<a href="adminscore.jsp" class="style1">返回前页</a></p>
<p><br>
<img src="images/qa.jpg" width="640" height="427"></p>
</div>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -