delsub.jsp

来自「在线考试系统」· JSP 代码 · 共 68 行

JSP
68
字号
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="../../conndb.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<%
int j=0;
Statement stmt=conn.createStatement();
String teacon=(String)session.getAttribute("teacon");
if(teacon.equals("Clanguage"))
{	j=1;}
 if(teacon.equals("Structure"))
{	j=2;}
 if(teacon.equals("Internet"))
{	j=3;}
 if(teacon.equals("Java"))
{	j=4;}

String subtype=request.getParameter("subtype");
if(subtype.equals("choice"))
{
	String Cid=request.getParameter("Cid");
	switch(j)
	{	
		case 1:
			stmt.executeUpdate("delete from Cchoice where id='"+Cid+"'");
			break;
		case 2:
			stmt.executeUpdate("delete from Schoice where id='"+Cid+"'");
			break;
		case 3:
			stmt.executeUpdate("delete from Ichoice where id='"+Cid+"'");
			break;
		case 4:
			stmt.executeUpdate("delete from Jchoice where id='"+Cid+"'");
			break;
	}
	response.sendRedirect("editSub.jsp");
}
if(subtype.equals("fill"))
{
	String Fid=request.getParameter("Fid");
	switch(j)
	{	
		case 1:
			stmt.executeUpdate("delete from Cfill where id='"+Fid+"'");
			break;
		case 2:
			stmt.executeUpdate("delete from Sfill where id='"+Fid+"'");
			break;
		case 3:
			stmt.executeUpdate("delete from Ifill where id='"+Fid+"'");
			break;
		case 4:
			stmt.executeUpdate("delete from Jfill where id='"+Fid+"'");
			break;
	}
	response.sendRedirect("editSub.jsp");
}
%>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?