WebRoot/CourseAdd.jsp

(开头部分) 2KB

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

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*,prj.db.*,java.util.*" errorPage="" %>
<%
request.setCharacterEncoding("utf-8");

Integer userId = (Integer)request.getSession().getAttribute("UserId");
if( request.getParameter("Action") != null ) {
    Class.forName(DbConfig.DriverName); 
    Connection conn = DriverManager.getConnection(DbConfig.ConnString); 
    Statement stmt = conn.createStatement();
   	String sql = "INSERT INTO [Course] ([Name],[Type],[Score]) VALUES('"+request.getParameter("Name")+"','"+request.getParameter("Type")+"',"+request.getParameter("Score")+")";
    sql = sql.replace("'null'", "null");
    stmt.executeUpdate(sql);

	response.sendRedirect("CourseList.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><input id="Name" name="Name" type="text" value=""></td>
						</tr>
						<tr style="width: 79%;">
							<td style="width: 164px;" align="right">类型</td>
							<td>
                                                            <input id="Type" name="Type" type="radio" value="必修" checked="checked" >必修
                                                            <input id="Type" name="Type" type="radio" value="选修">选修
                                                        </td>
						</tr>
						<tr style="width: 79%;">
							<td style="width: 164px;" align="right">学分</td>
							<td><input id="Score" name="Score" type="text" value=""></td>
						</tr>
						<tr style="width: 79%;" align="center">
							<td colSpan="2">
								<input type="submit" value="保存" />
							</td>
						</tr>
					</table>
				</form></div>
后面还有 8 行代码,购买后查看完整代码

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

AI 解读 AI

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

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