📄 delete.jsp
字号:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="law.user" %>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<html>
<head><title>delete</title></head>
<body>
<center>
<jsp:useBean id="log" class="law.user" scope="session"/>
<%
if(log.getLogin().equals("true")){
long num=0;
String strnum=request.getParameter("num");
if(strnum==null)strnum="";
if(strnum.equals(""))
strnum="无";
try{
num=Long.valueOf(strnum).longValue();
}catch(NumberFormatException e){
num=0;
}
if(num<1){
%>
<jsp:include page="head.txt"/>
<%
out.print("<font color=#FF0000>找不到您需要的资料,请与管理员联系。");
}
else
{
Connection con;
Statement sql;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:law","","");
sql=con.createStatement();
String condition="delete from data where num="+num;
sql.executeUpdate(condition);
con.close();
%>
<jsp:include page="head.txt"/>
<%
out.print("<font color=#FF0000>删除成功。");
}catch(SQLException e){
%>
<jsp:include page="head.txt"/>
<%
out.print(e+"<font color=#FF0000>找不到您需要的资料,请与管理员联系。");
}catch(ClassNotFoundException e){
%>
<jsp:include page="head.txt"/>
<%
out.print(e+"<font color=#FF0000>找不到您需要的资料,请与管理员联系。");
}
}
}
else{
out.print("<font color=#FF0000>您还没有登录。<br><a href='index.htm'>首页 </a>");
}
%>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -