errorpad_decrate.jsp
上传用户:nbluoke
上传日期:2013-08-09
资源大小:4851k
文件大小:3k
源码类别:

教育系统应用

开发平台:

WORD

  1. <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
  2. <%@ page import="jinghua.*"%>
  3. <jsp:useBean id="DBCon" class="jinghua.JinghuaConn" scope="session">
  4. </jsp:useBean>
  5. <%!boolean debug=true;
  6. %>
  7. <%
  8. String strPage=request.getParameter("OnPage");
  9. String errorpad_grade=request.getParameter("Grade");
  10. String errorpad_sub=request.getParameter("Subject");
  11. String errorpad_knowpoint=request.getParameter("KnowPoint");
  12. String errorpad_testtype=request.getParameter("testtype");
  13. String errorpad_errorcount=request.getParameter("errorcount");
  14. if(debug){
  15.     out.print("<br>grade="+errorpad_grade+
  16.     "<br>sub="+errorpad_sub+
  17.     "<br>knowpoint="+errorpad_knowpoint+
  18.     "<br>testtype="+errorpad_testtype+
  19.     "<br>errorcunt="+errorpad_errorcount);
  20. }
  21. if(errorpad_grade!=null)
  22. {
  23.     session.setAttribute("errorpad_grade",errorpad_grade);
  24. }
  25. else
  26. {
  27.     errorpad_grade=(String)session.getAttribute("errorpad_grade");
  28. }
  29. if(errorpad_sub!=null)
  30. {
  31.     session.setAttribute("errorpad_sub",errorpad_sub);
  32. }else
  33. {
  34.     errorpad_sub=(String)session.getAttribute("errorpad_sub");
  35. }
  36. if(errorpad_knowpoint!=null)
  37. {
  38.     session.setAttribute("errorpad_knowpoint",errorpad_knowpoint);
  39. }
  40. else
  41. {
  42.     errorpad_knowpoint=(String)session.getAttribute("errorpad_knowpoint");
  43. }
  44. if(errorpad_testtype!=null)
  45. {
  46.     session.setAttribute("errorpad_testtype",errorpad_testtype);
  47. }
  48. else
  49. {
  50.     errorpad_testtype=(String)session.getAttribute("errorpad_testtype");
  51. }
  52. if(errorpad_errorcount!=null)
  53. {
  54.     session.setAttribute("errorpad_errorcount",errorpad_errorcount);
  55. }
  56. else
  57. {
  58.     errorpad_errorcount=(String)session.getAttribute("errorpad_errorcount");
  59. }
  60. String [] ids=request.getParameterValues("id");
  61. if(ids==null){
  62.      Tools.showalert("请您选择欲删除的知识点!",out);
  63.     Tools.goback(out);
  64. }else
  65. {
  66. String stuID=request.getParameter("stu_id");
  67. String sql;
  68. StringBuffer sb=new StringBuffer();
  69. for(int i=0;i<ids.length;i++){
  70.     sb.append(ids[i]+",");
  71. }
  72. sql=sb.toString().substring(0,sb.length()-1);
  73. sql="update errorpad set errorcount=errorcount-1 where id in("+sql+")";
  74. if(debug){
  75.     out.print("<br>sql="+sql);
  76. }
  77.     try{
  78.         Connection con=DBCon.getConnection();
  79.         PreparedStatement pstmt=con.prepareStatement(sql);
  80.         pstmt.executeUpdate();
  81.         pstmt.close();
  82.         if(debug){
  83.             out.print("<BR>delete errorpad sql="+sql);
  84.         }
  85.         Tools.showalert("成功错题成功!",out);
  86.         response.sendRedirect("errorpad.jsp?page="+strPage);
  87.         //Tools.showJS("window.open('admin_subject.jsp','_self')",out);
  88.     }
  89.     catch(SQLException se){
  90.         out.println(se.toString());
  91.     }
  92.     catch(Exception e){
  93.         out.print(e.toString());
  94.     }
  95.     finally{
  96.         DBCon.dropConnection();
  97.     }
  98. }
  99. %>