📄 list_del.jsp
字号:
<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GB18030" import="java.sql.*,java.util.*"%>
<%@ include file="config.ini"%>
<%@ include file="conn.jsp"%>
<%@ include file="readlogin.jsp"%>
<%
//接收要删除的联系人的id
String id=request.getParameter("id");
String action=null;
if(id==null)
{
out.print("<script>");
out.print("alert('id错误');");
out.print("location.href='list.jsp';");
out.print("</script>");
}
%>
<%
try{
//接收用户请求中包含的参数
action=request.getParameter("action");
//如果请求中的参数为del,则执行数据库中删除记录的操作
if(action.equals("del"))
{
try
{
sqlstr="delete from list where id="+id;
//调用JavaBean中的业务逻辑方法,进行数据库删除操作
iCanDb.doDelete(sqlstr);
out.print("<script>");
out.print("alert('删除成功!');");
out.print("location.href='list.jsp';");
out.print("</script>");
}
catch(Exception e)
{
out.print("<script>");
out.print("alert('数据库出错!');");
out.print("location.href='list.jsp';");
out.print("</script>");
}
}
if(action.equals("confirm"))
{
try
{
sqlstr="select name from list where id="+id;
rs=iCanDb.doSelect(sqlstr);
rs.next();
%>
<html>
<head>
<%@ include file="head.jsp"%>
</head>
<body>
<center>
<table border="0" width="768" id="table1" cellspacing="0" cellpadding="0">
<tr>
<%@ include file="top.jsp"%>
</tr>
<tr>
<td width="90" valign="top">
<%@ include file="menu.jsp"%> </td>
<td width="588" valign="top"><center>
<table border="0" width="100%" id="table3" cellspacing="0" cellpadding="0">
<tr>
<td>
<table border="1" width="588" id="table4" bordercolorlight="#0A9EE4" cellspacing="0" cellpadding="5" bordercolordark="#0A9EE4">
<tr>
<td>
<table border="0" width="100%" id="table5" cellspacing="0" cellpadding="0">
<tr>
<td>
<table border="0" width="100%" id="table6" cellspacing="0" cellpadding="0">
<tr>
<td valign="bottom" width="50%">
</td>
<td width="50%">
<img src="images/n-list.jpg" align="right" width="230" height="70"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><hr noshade color="#0A9EE4" size="1"></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><center><table border="0" width="450" id="table2" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="450" id="table2" cellspacing="0" cellpadding="0"><tr>
<td height="25" align="left" valign="middle" background="images/tdbg1.gif">
<table border="0" width="100%" id="table3" cellspacing="0" cellpadding="0">
<tr>
<td>
<p align="center">
<b><font size="2" color="#FFFFFF">删除</font></b><font size="2" color="#FFFFFF"><b>记录</b></font></td>
</tr>
</table>
</td></tr></table></td>
</tr>
<tr>
<td>
<table border="1" width="100%" id="table4" bordercolor="#156FC7" style="border-collapse: collapse" cellpadding="3" cellspacing="0" height="150">
<tr>
<td width="97%" align="center" height="38">
<font size="2" color="#156FC7">确认删除下面的记录?</font></td>
</tr>
<tr>
<td width="97%" height="53">
<p align="center"><font size="2" color="#156FC7"><%=rs.getString("name")%></font></td>
</tr>
<tr>
<td>
<p align="center">
<input type="button" value="提交" name="B1" style="border: 1px solid #156FC7" onclick="javascript:location.href='list_del.jsp?action=del&id=<%=id%>';">
<input type="button" value="返回" name="B2" style="border: 1px solid #156FC7" onclick="javascript:location.href='list.jsp';"></td>
</tr>
</table>
</center></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="16">
<p style="line-height: 150%">
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="90"> </td>
</tr>
<tr>
<td width="90" valign="top">
</td>
<td width="588" valign="top">
<%@ include file="copyright.jsp"%>
</td>
<td width="90"> </td>
</tr>
</table>
<p>
</center>
</p>
</body>
</html>
<%
}
catch(Exception e)
{
out.print("<script>");
out.print("alert('数据库出错');");
out.print("location.href='list.jsp';");
out.print("</script>");
}
}
else
{
out.print("<script>");
out.print("location.href='list.jsp';");
out.print("</script>");
}
}
catch(Exception e)
{
out.print("<script>");
out.print("location.href='list.jsp';");
out.print("</script>");
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -