⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 del.jsp

📁 一个用jsp/servlet编写的留言板程序。安全 稳定 耐用 可靠
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" %>
<html>
<head>
<title>重庆杰诺软件</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/style" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#CCCCCC">
<%String action=request.getParameter("action");
if(action==null){%>
<blockquote>
  <form name="form1" method="post" action="del.jsp?action=del">
    <table width="345" height="99" border="0" align="center" cellpadding="0" cellspacing="2" bgcolor="#FFFFFF">
      <tr align="center" background="images/table.gif"> 
        <td height="24" colspan="2"><strong><font color="#FFFFFF">删除留言</font></strong></td>
      </tr>
      <tr> 
        <td width="32%" height="22" align="center">用户名:</td>
        <td width="68%"><input name="username" type="text" id="username"></td>
      </tr>
      <tr> 
        <td align="center">密 码:</td>
        <td><input name="password" type="password" id="password"> <input name="id" type="hidden" id="id" value="<%=request.getParameter("id")%>"></td>
      </tr>
      <tr align="center"> 
        <td colspan="2"><input type="submit" name="Submit" value="删除">
           
<input type="button" name="Submit2" value="重写" onClick="javascript:history.go(-1)">
            
          <input type="button" name="Submit22" value="返回" onClick="window.location.href='index.jsp'"></td>
      </tr>
    </table>
  </form>
</blockquote>
<%}else{%>
<jsp:useBean class="guestbook.GuestBookJdbc" id="guestbook" scope="page"/>
<%
   String username=request.getParameter("username");
   String password=request.getParameter("password");
String myid=request.getParameter("id");
int yid=java.lang.Integer.parseInt(myid);
Connection Conn=guestbook.GetConn();
Statement stmt=Conn.createStatement();
   String sql="select count(*) from admin where username='"+username+"' and password='"+password+"'";
   try{
     ResultSet Rs=stmt.executeQuery(sql);
	 Rs.next();
     if(Rs.getInt(1)==0){
	   out.print("<script>");
       out.print("alert('用户名或密码出错!');");
       out.print("window.location.href='index.jsp';");
       out.print("</script>");
	 }
	 else
	 {
        String sqlr="delete  from Guestbook where id=" + yid;
    try{
//out.print(sql);
          stmt.executeUpdate(sqlr);
         out.print("<script>");
         out.print("alert('删除成功!');");
         out.print("window.location.href='index.jsp';");
         out.print("</script>");
      }catch(Exception e){
       out.print("出错了!");
     }
	
   }
 	 }catch(Exception e)
     {
	  out.print("出错了!");
	 }
}
%>
<table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="22" align="center">CopyRight 2003-2005 &copy; 重庆杰诺软件版权所有 </td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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