WebRoot/ClazzList.jsp

(开头部分) 2KB

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

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*,prj.db.*,java.util.*" errorPage="" %>
<%
Class.forName(DbConfig.DriverName); 
Connection conn = DriverManager.getConnection(DbConfig.ConnString); 
Statement stmt = conn.createStatement();
ResultSet rs = null;
String sql = null;

request.setCharacterEncoding("utf-8");
%>
<!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>
<%
Integer userId = (Integer)request.getSession().getAttribute("UserId");
if( request.getParameter("Action") != null && request.getParameter("Action").toString().equals("delete") ) {
    sql = "DELETE FROM [Clazz] WHERE [Id]=" + request.getParameter("id");
    stmt.executeUpdate(sql);
	response.getWriter().print("<script type='text/script'>window.alert('操作成功!');</script>");
}
%>
<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>
			<table style="border-color: black; width: 100%; font-family: verdana; font-size: 8pt; border-collapse: collapse;" 
				border="1" rules="all" cellSpacing="0" cellPadding="2">
				<tr style="font-weight: bold; background-color: rgb(248, 250, 252); font-size:10pt;" vAlign="middle" align="center">
				<th>班级代号</th>
				<th>教师</th>
				<th>操作</th>
			</tr>
			<%
                sql = "SELECT [Clazz].*, [Teacher].Name AS TeacherName  FROM [Clazz] LEFT JOIN [Teacher] ON [Clazz].[Teacher] = [Teacher].[Id]";
                rs = stmt.executeQuery(sql);
                while(rs.next()){
			%>
			<tr style="font-style: normal; font-weight: normal; text-decoration: none; background-color: white; font-size:10pt;" align="center">
                <td><%=((rs.getObject("Name") == null) ? "" : rs.getObject("Name"))%></td>
                <td><%=((rs.getObject("TeacherName") == null) ? "" : rs.getObject("TeacherName"))%></td>
				<td>
					<a href="ClazzEdit.jsp?id=<%=rs.getObject("Id")%>">修改</a> 
					<a href="?Action=delete&id=<%=rs.getObject("Id")%>">删除</a> 
				</td>
			</tr>
			<%
				}
                rs.close();
                stmt.close();
                conn.close();
			%>
		</table>
	</div></td>
后面还有 6 行代码,购买后查看完整代码

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

AI 解读 AI

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

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