WebRoot/CourseScoreAdd.jsp

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*,prj.db.*,java.util.*" errorPage="" %>
<%
request.setCharacterEncoding("utf-8");
    Class.forName(DbConfig.DriverName); 
    Connection conn = DriverManager.getConnection(DbConfig.ConnString); 
    Statement stmt = conn.createStatement();
Integer userId = (Integer)request.getSession().getAttribute("UserId");
if( request.getParameter("Action") != null ) {
    String sql = "DELETE FROM [CourseScore] WHERE [Student]=" + request.getParameter("Student") + " AND [Course]=" + request.getParameter("Course");
    stmt.executeUpdate(sql);

   	sql = "INSERT INTO [CourseScore] ([Course],[Student],[Score]) VALUES("+request.getParameter("Course")+","+request.getParameter("Student")+","+request.getParameter("Score")+")";
    sql = sql.replace("'null'", "null");
    stmt.executeUpdate(sql);

	response.sendRedirect("CourseScoreList.jsp");
    return;
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<style>td { font-size: 12px; }</style>
</head>
<body>

    <table border="1" cellSpacing="0" borderColorLight="#145aa0" borderColorDark="#9cc7ef" cellPadding="4" width="100%" align="center">
		<tr bgColor="#4296e7">
			<td colSpan="2"><div align="center"><font color="#ffffff">添加课程成绩</font></div></td>
		</tr>
		<tr>
			<td><br />
				<div><form action="" method="post">
					<input type="hidden" name="Action" value="insert" />
                    <table style="border-width: 1px; border-style: solid; width: 100%; height: 50px; border-collapse: collapse;"
						border="1" rules="all" cellSpacing="0" cellPadding="4">
						<tr style="width: 79%;">
							<td style="width: 164px;" align="right">课程</td>
							<td>
<%
Statement stmtCourse = conn.createStatement();
ResultSet rsCourse = stmtCourse.executeQuery("SELECT * FROM [Course]");
%>
<select id="Course" name="Course">
<%
while(rsCourse.next()){
%>
<option value="<%=rsCourse.getObject("Id")%>"><%=rsCourse.getObject("Name")%></option>
<%
}
%>
</select>
                            
                            </td>
						</tr>
						<tr style="width: 79%;">
后面还有 37 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。