questiondel.jsp
资源名称:examasp.rar [点击查看]
上传用户:hjt198082
上传日期:2015-04-16
资源大小:95k
文件大小:2k
源码类别:
MySQL数据库
开发平台:
Java
- <%@page contentType="text/html;charset=GBK"%>
- <%@page import="java.sql.*" errorPage="/public/error.jsp"%>
- <%@ include file="/public/checkvalidadmin.jsp"%>
- <%@ include file="/public/checkvalidadmin8.jsp"%>
- <jsp:useBean id="conn" scope="page" class="test.ConnOracle"/>
- <%!
- String questionid;
- ResultSet rs = null;
- String sql = "";
- int result = 0;
- String currpage = "1";
- %>
- <%
- questionid = request.getParameter("id");
- currpage = request.getParameter("Page");
- // 避免用户直接在浏览器地址栏输入页面地址所产生的Exception
- if(questionid==null || questionid.equals("")) {
- out.println("<center>");
- out.println("请进行合法操作!");
- out.println("</center>");
- return;
- }
- try{
- sql = "select * from test_question_lib where ";
- sql += " questionid=" + questionid;
- rs = conn.executeQuery( sql );
- if(!rs.next()) {
- out.println("<center>");
- out.println("数据库没有代号为" + questionid + "的试题信息!<br>");
- out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
- out.println("</center>");
- } else {
- sql = "delete from test_question_lib ";
- sql+= " where questionid=" + questionid;
- result = conn.executeUpdate( sql );
- if(result !=1 ) {
- out.println("<center>");
- out.println("试题信息删除失败!<br><br>");
- out.println("请将下列信息告知管理员<br><br>");
- out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
- out.println("</center>");
- }
- }
- }catch(Exception ee) {
- out.println("<center>");
- out.println("试题信息删除失败!<br><br>");
- out.println("请将下列信息告知管理员<br><br>");
- out.println(ee.toString() + "<br><br>");
- out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
- out.println("</center>");
- }
- %>
- <jsp:forward page="questionmanager.jsp">
- <jsp:param name="Page" value="<%=currpage%>"/>
- </jsp:forward>
- </center>
- </Body>
- </html>