JSP留言簿系统无版权 第8页
');window.location.href='index.jsp';</script>");
}else{
out.println("<script language='javascript'>alert('回复信息失败!');window.location.href='reply.jsp';</script>");
}
}else{
response.sendRedirect("index.jsp");
}
%>
Del.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="connBean" class="beans.connDB" scope="page"/>
<%
int TopicID=Integer.parseInt(request.getParameter("TopicID"));
String sql="Delete from tb_Topic where ID="+TopicID;
int ret=0;
ret=connBean.executeUpdate(sql);
if (ret!=0){
out.println("<script language='javascript'>alert('留言信息删除成功!');window.location.href='index.jsp';</script>");
}else{
out.println("<script language='javascript'>alert('留言信息删除失败!');window.location.href='index.jsp';</script>");
} %>
connDB.java
package beans;
import java.sql.*;
public class connDB{
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
public connDB(){
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
}catch(java.lang.ClassNotFoundException e){
System.err.println(e.getMessage());
}
}
public ResultSet executeQuery(String sql){
try{
conn=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=db_board;user=sa;password=123456");
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery(sql);
}catch(SQLException ex){
System.err.println(ex.getMessage());
}
return rs;
需要完整内容的请联系QQ752018766,JSP留言簿系统没有版权免费,转发请注明源于www.chuibin.com
result=0;
}
return result;
}}
上一页 [1] [2] [3] [4] [5] [6] [7] [8]