catch(SQLException se1){se1.printStackTrace(); conn.rollback();}finally{conn.setAutoCommit(autoCommit);conn.close();}%>
//**********************删除页面之一:提示要删除的信息delete.jsp
<%@ include file="article.jsp"%><%
String id=request.getParameter("id");String title=request.getParameter("title");//out.println(title);%><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=Big5"> <title>確認刪除</title> </head> <body> <div align="center"> <p> </p><table border="1" cellspacing="0" width="50%" bgcolor="#F0F8FF" bordercolorlight="#000000" bordercolordark="#FFFFFF" align="center"> <tr> <td width="100%" bgcolor="#B5D85E" height="20"> <p align="center"><font color="#FFFFFF"><b>刪除信息</b></font> </td> </tr> <tr> <td width="100%" height="177"> <table width="80%" border="0" cellspacing="0" cellpadding="2" align="center" bordercolorlight="#000000" bordercolordark="#FFFFFF"> <br><br> <tr> <td>確認刪除編號為:<font color="#FF0000"><%=id%></font> , 名稱為<font color="#FF0000"><%=title%></font>的信息嗎?</td> </tr> </table> <br><br> <p align="center"><a href="saveDelete.jsp?id=<%=id%>">是</a> <a href="manage.jsp">否</a></p> </td> </tr> </table></div> </body>
</html>//***************删除页面之二:saveDelete.jsp,删除成功后直接跳转到manage.jsp页面
<%@ include file="articleconn.jsp"%><%
String id=request.getParameter("id");boolean autoCommit=conn.getAutoCommit();String delete=" delete from learning where article_id="+id+" ";
try{conn.setAutoCommit(false);PreparedStatement ps=conn.prepareStatement(delete);int rs=ps.executeUpdate();if(rs>0){response.sendRedirect("manage.jsp");}}catch(SQLException se1){se1.printStackTrace(); conn.rollback();}finally{conn.setAutoCommit(autoCommit); conn.close();}%>
上一页 [1] [2]
Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved. 闵涛 E_mail:admin@mintao.net(欢迎提供学习资源)
鄂公网安备 42011102001154号
站长:MinTao ICP备案号:鄂ICP备11006601号-18