#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"> <tr> <td>信息名稱為:<font color="#FF0000"><%=title%></font></td> <td>編號為:<font color="#FF0000"><%=id%></font></td> </tr> </table> <p align="center"> </p> <p align="center"><a href="manage.jsp">返回管理頁面</a><br> </p> </td> </tr> </table> </div> <% //response.sendRedirect("manage.jsp"); } conn.commit(); } 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] |