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

教育系统应用

开发平台:

WORD

  1. <%@ page contentType="application/msword; charset=gb2312" language="java" import="java.sql.*" %>
  2. <%@ page import="java.sql.*"%>
  3. <%@ page import="java.text.*"%>
  4. <%@ page import="jinghua.*"%>
  5. <%@ page import="java.util.*"%>
  6. <%@ page import = "jinghua.chart.servlet.WebHitChart" %>
  7. <%@ page import = "jinghua.chart.servlet.WebHitDataSet" %>
  8. <%@ page import = "java.io.PrintWriter" %>
  9. <jsp:useBean id="DBCon" class="jinghua.JinghuaConn" scope="session">
  10. </jsp:useBean>
  11. <%!Connection con;
  12. //查询参加某次模拟考试的所有学生的ID
  13. String colwidth="";
  14. boolean debug=false;
  15. String studentID="";
  16. String gradenote="";
  17. String gradename="";
  18. int maxHisSubNum =0;
  19. String mn_testID="";
  20. Statement stmt=null;
  21. ResultSet rs=null;
  22. String sql="";
  23. String test_subs="";
  24. int sub_num=0;
  25. int have_test=0;
  26. int i=0;
  27. int j=0;
  28. long i10=0;
  29. long i30=0;
  30. float f10=0;
  31. float f30=0;
  32. DecimalFormat df=new DecimalFormat("####.00");
  33. class mn_test{
  34.     String id;
  35.     String name;
  36.     String gradenote;
  37.     String subs;
  38.     String totalMark;
  39.     int sub_num;
  40.     int testPeople;//全部参加人数
  41.     //参加完所有测试的学生的ID,用","分隔
  42. int flag;//1:complete;2:uncomplete;3:do not any test;
  43.     public String toString(){
  44.         String temp="";
  45.         temp="<br> id="+id+"<br> name="+name;
  46.         return temp;
  47.    }
  48. };
  49. class student{
  50.     String id;
  51.     String name;
  52.     String jh_area;
  53.     String school;
  54.     String jh_area_sch;
  55.     String grade;
  56.     String test_date;
  57.     int total_mark;//总分
  58.     String avgTop10;//top 10%的总分
  59.     String avgTop30;
  60.     int posAll;//全部排名
  61.     int posPercent;//100人排名
  62.     public String toString(){
  63.         String temp="";
  64.         temp="<br> id="+id+"<br> name="+name+"<br> grade="+grade+"<br>jh_area="+jh_area+
  65.         "<br>school="+school+"<br>jh_area_sch="+jh_area_sch+"<br>test_date="+test_date;
  66.         return temp;
  67.    }
  68. };
  69. class History{
  70.     long id;
  71.     String stu_id;
  72.     String mn_test_id;
  73.     int sub_num;
  74.     int testPeople;
  75.     String tested_id;
  76.     int totalmark;
  77.     String position;
  78.     String top10avg;
  79.     String top30avg;
  80.     String testdate;
  81.     String [] sub_names;
  82.     String [] sub_marks;
  83.     String debug;
  84.     public String toString(){
  85.         String temp="";
  86.         temp="<br> id="+id+"<br> stu_id="+stu_id+"<br> mn_test_id="+mn_test_id+
  87.             "<br>totalmark="+totalmark+"<br>position="+position+
  88.             "<br>top10avg="+top10avg+"<br>top30avg="+top30avg;
  89.         return temp;
  90.    }
  91. };
  92. class Subject{
  93.     int sub_id;
  94.     String name;
  95.     String totalMark;
  96.     String realMark;
  97.     String avgArea;
  98.     String avgTotal;
  99.     String avgTop10;
  100.     String avgTop30;
  101.     String posAll;//全部排名
  102.     String posPercent;//100人排名
  103.     int testnum=0;//试题数目
  104.     String [] arrAnswer;
  105.     String [] arrMark;
  106.     String [] arrSubAnswer;
  107.     String [] arrTF;
  108.     String [] arrDif;
  109.     String [] arrSubMark;
  110.     String [] arrRate;//准确率
  111.     String [] arrID;//question id数组
  112.     public String toString(){
  113.         String temp="";
  114.         temp="<br> sub_id="+sub_id+"<br> name="+name+"<br> totalMark="+totalMark+
  115.         "<br>avgArea="+avgArea+"<br>avgTotal="+avgTotal+"<br>avgTop10="+avgTop10+
  116.         "<br>avgTop30="+avgTop30+ "<br>posAll="+posAll+ "<br>posPercent="+posPercent;
  117.         return temp;
  118.    }
  119. };
  120. mn_test mnTest;
  121. student Student;
  122. Vector subs;
  123. Vector hisRS;
  124. %>
  125. <%
  126. try{
  127.     studentID=request.getParameter("stuID");
  128. mn_testID=request.getParameter("mn_testID");
  129.     //Tools.showalert(studentID,out);
  130. }catch(Exception e){
  131.     Tools.showalert("您还没有登录,或连接超时,请重新登录!",out);
  132.     Tools.showJS("window.open('../login.jsp','_self')",out);
  133. }
  134. try{
  135.     con=DBCon.getConnection();
  136. String filenamemn =request.getParameter("filenamemn");// WebHitChart.generateMnBarChart(Long.parseLong(mn_testID), session, new PrintWriter(out));
  137. String graphURLmn = request.getContextPath()+"/chart/temp/"+filenamemn; //+ "/servlet/DisplayChart?filename=" + filenamemn;
  138.     String filenamestu = request.getParameter("filenamestu");//WebHitChart.generateStuHisXYChart(studentID, Long.parseLong(mn_testID),session, new PrintWriter(out));
  139. String graphURLstu = request.getContextPath()+"/chart/temp/"+filenamestu; //+ "/servlet/DisplayChart?filename=" + filenamestu;
  140.     out.print("<br>graphURLmn="+graphURLmn);
  141.     out.print("<br>graphURLstu="+graphURLstu);
  142.     //获取学生的年级信息
  143.     sql=" SELECT   `grade`.`Name`,  `grade`.`note` FROM"+
  144.         "  `grade`  INNER JOIN `UserInfo` ON (`grade`.`note` = `UserInfo`.`gradenote`)"+
  145.         " WHERE  (`UserInfo`.`vcUserNo` = '"+studentID+"')";
  146.     try{
  147.         stmt=con.createStatement();
  148.         rs=stmt.executeQuery(sql);
  149.         if(rs.next()){
  150.             gradenote=rs.getString("note");
  151.             gradename=rs.getString("Name");
  152.             rs.close();
  153.             stmt.close();
  154.         }
  155.         if(debug){
  156.             out.print("<br>stuID="+studentID+"<br>gradenote="+gradenote);
  157.         }
  158.     }
  159.     catch(SQLException se){
  160.         out.print("<br> query student error sql="+sql);
  161.         out.print("<br>"+se.toString());
  162.     }
  163.     catch(Exception e){
  164.         out.print("<br> query student error sql="+sql);
  165.         out.print("<br>"+e.toString());
  166.     }
  167.     //获取模拟考试的科目信息
  168.     sql="select * from mn_test where id="+mn_testID;
  169.     try{
  170.         mnTest=new mn_test();
  171.         Student=new student();
  172.         subs=new Vector();
  173.         stmt=con.createStatement();
  174.         rs=stmt.executeQuery(sql);
  175.         if(rs.next()){
  176.             mnTest.subs=rs.getString("subs");
  177. if(mnTest.subs==null)
  178. mnTest.subs="-1";
  179. else if(mnTest.subs.equals(""))
  180. mnTest.subs="-1";
  181.             mnTest.id=mn_testID;
  182.             mnTest.name=rs.getString("name");
  183.             mnTest.sub_num=rs.getInt("sub_num");
  184.             mnTest.gradenote=gradenote;
  185.             mnTest.testPeople=rs.getInt("testpeople");
  186.         }
  187. rs.close();
  188.         stmt.close();
  189.         if(debug){
  190.             out.print("<br>mn_test_subs="+mnTest.subs+"<br>sub_num="+mnTest.sub_num);
  191.         }
  192.     }
  193.     catch(SQLException se){
  194.         out.print("<br> query mn_test error sql="+sql);
  195.         out.print("<br>"+se.toString());
  196.     }
  197.     catch(Exception e){
  198.         out.print("<br> query mn_test error sql="+sql);
  199.         out.print("<br>"+e.toString());
  200.     }
  201.     //
  202.     //如果完成了模拟考试,
  203.     have_test=0;
  204.     sql="select count(*) as have_test from mn_history where stu_id='"+studentID+"' and mn_test_id="+mn_testID;
  205.     try{
  206.         stmt=con.createStatement();
  207.         rs=stmt.executeQuery(sql);
  208.         if(rs.next()){
  209.             have_test=rs.getInt("have_test");
  210.         }
  211.         rs.close();
  212.         stmt.close();
  213.         if(debug){
  214.             out.print("<br>query mn_history sql="+sql);
  215.         }
  216.     }
  217.     catch(SQLException se){
  218.         out.print("<br>query mn_history sql="+sql);
  219.         out.print("<br>"+se.toString());
  220.     }
  221.     catch(Exception e){
  222.         out.print("<br>query mn_history sql="+sql);
  223.         out.print("<br>"+e.toString());
  224.     }
  225.     //查询该学生是否完成该模拟考试中的所有测试
  226. %>
  227. <%if(mnTest.sub_num==0){
  228.      Tools.showalert("模拟考试还没有进行!",out);
  229.                     Tools.showJS("window.close()",out);
  230. }else if (have_test<1){
  231.      Tools.showalert("您还没有全部参加完这次模拟考试的各科测试,不能统计分数!",out);
  232.                     Tools.showJS("window.close()",out);
  233. }else{
  234.     //查询模拟考试的总分
  235.     sql="select FORMAT(sum(mark),0) as totalmark from test,mn_scores "+
  236.         "where test.id=mn_scores.test_id and mn_test_id="+mn_testID+" and stu_id='"+
  237.         studentID+"'";
  238.     try{
  239.         stmt=con.createStatement();
  240.         rs=stmt.executeQuery(sql);
  241.         if(rs.next()){
  242.             mnTest.totalMark=rs.getString("totalmark");
  243.         }
  244. rs.close();
  245.         stmt.close();
  246.         if(debug){
  247.             out.print("<br>mn_test totalMark sql="+sql);
  248.             out.print("<br>mn_test totalMark="+mnTest.totalMark);
  249.         }
  250.     }
  251.     catch(SQLException se){
  252.         out.print("<br> query totalpeople error sql="+sql);
  253.         out.print("<br>"+se.toString());
  254.     }
  255.     catch(Exception e){
  256.         out.print("<br> query totalpeople error sql="+sql);
  257.         out.print("<br>"+e.toString());
  258.     }
  259.     //查询学生信息,生成成绩单,考试日期取为所有试卷最后做的时间
  260.     sql="SELECT   `UserInfo`.`vcName`,  `UserInfo`.`vcUserNo`, "+
  261.     "  DATE_FORMAT(`mn_scores`.`test_date`,"%Y-%m-%e") as test_date,  `UserInfo`.`vcSchool`,  `UserInfo`.`jh_area`,CONCAT(`UserInfo`.`jh_area`,'<br>(',`UserInfo`.`vcSchool`,')') AS jh_area_sch "+
  262.     "FROM  `UserInfo`  LEFT OUTER JOIN `grade` ON (`UserInfo`.`gradenote` = `grade`.`note`) "+
  263.     "LEFT OUTER JOIN `mn_scores` ON (`UserInfo`.`vcUserNo` = `mn_scores`.`stu_id`) "+
  264.     "WHERE UserInfo.vcUserNo='"+studentID+"' and mn_scores.mn_test_id="+mn_testID+
  265.     " and mn_scores.stu_id='"+studentID+"'"+
  266.     " ORDER BY test_date DESC"+
  267.     " LIMIT 1";
  268.     try{
  269.     stmt=con.createStatement();
  270.     rs=stmt.executeQuery(sql);
  271.     if(rs.next()){
  272.         Student.grade=gradename;
  273.         Student.id=rs.getString("vcUserNo");
  274.         Student.jh_area=rs.getString("jh_area");
  275.         Student.jh_area_sch=rs.getString("jh_area_sch");
  276.         Student.name=rs.getString("vcName");
  277.         Student.school=rs.getString("vcSchool");
  278.         Student.test_date=rs.getString("test_date");
  279.     }
  280.         rs.close();
  281.         stmt.close();
  282.         if(debug){
  283.             out.print("<br> query student info  sql="+sql);
  284.             //out.print("<br>student info="+Student.toString());
  285.         }
  286.     }
  287.     catch(SQLException se){
  288.         out.print("<br> query student info error sql="+sql);
  289.         out.print("<br>"+se.toString());
  290.     }
  291.     catch(Exception e){
  292.         out.print("<br> query student info error sql="+sql);
  293.         out.print("<br>"+e.toString());
  294.     }
  295.     //成绩和排名
  296.     //总分
  297.     try{
  298.     //个人总分
  299.     sql=" SELECT mn_history.stu_id,mn_history.mn_test_id,  FORMAT(SUM(mn_scores.score),0) AS totalmark"+
  300.         " FROM  `mn_history`  LEFT OUTER JOIN `mn_scores` ON  (`mn_history`.`mn_test_id` = `mn_scores`.`mn_test_id`) "+
  301.         "   AND (`mn_history`.`stu_id` = `mn_scores`.`stu_id`) "+
  302.         " WHERE mn_history.mn_test_id="+mnTest.id+" and mn_history.stu_id ='"+Student.id +"'"+
  303.         " GROUP BY mn_history.stu_id,mn_history.mn_test_id"+
  304.         " ORDER BY  totalmark desc";
  305.     stmt=con.createStatement();
  306.     rs=stmt.executeQuery(sql);
  307.     if(debug)
  308.         out.println("<br><br><br> person totalmark sql="+sql);
  309.     if(rs.next()){
  310.         Student.total_mark=rs.getInt("totalmark");
  311.     }
  312.     else{
  313.         Student.total_mark=0;
  314.     }
  315.     rs.close();
  316.     stmt.close();
  317.     //排名
  318.     i10=Math.round(mnTest.testPeople *0.1);//top10
  319.     i30=Math.round(mnTest.testPeople *0.3);
  320.     if(i10==0) i10=1;
  321.     if(i30==0) i30=1;
  322.     f10=0;
  323.     f30=0;
  324.     sql=" SELECT mn_history.stu_id,mn_history.mn_test_id,  FORMAT(SUM(mn_scores.score),0) AS totalmark"+
  325.         " FROM  mn_history LEFT OUTER JOIN mn_scores ON(mn_history.stu_id=mn_scores.stu_id) "+
  326.         " AND (`mn_history`.`mn_test_id` = `mn_scores`.`mn_test_id`)"+
  327.         " WHERE mn_history.mn_test_id="+mnTest.id+
  328.         " GROUP BY mn_history.stu_id,mn_history.mn_test_id"+
  329.         " ORDER BY  totalmark desc";
  330.     stmt=con.createStatement();
  331.     rs=stmt.executeQuery(sql);
  332.     i=0;
  333.     int imark=0;
  334.     int tempPos=1;
  335.     float fmark=0;
  336.     int tmark=Integer.MAX_VALUE;
  337.     while(rs.next()){
  338.         i++;
  339.         imark=rs.getInt("totalmark");
  340.         fmark=rs.getFloat("totalmark");
  341.         if(i<=i10)
  342.             f10+=fmark;
  343.         if(i<=i30)
  344.             f30+=fmark;
  345.         //查找分数的排名
  346.         if(debug){
  347.             out.print("<br><br>student totalmark="+Student.total_mark +
  348.             "<br>sql totalmark="+rs.getInt("totalmark"));
  349.         }
  350.         if(Student.total_mark==imark){
  351.             Student.posAll=tempPos;
  352.             if(mnTest.testPeople>100)
  353.                 Student.posPercent=100*tempPos/mnTest.testPeople;
  354.             else
  355.                 Student.posPercent=tempPos;
  356.         }
  357.         else if(tmark>imark){//分数不同
  358.             tempPos++;
  359.             tmark=imark;
  360.         }
  361.     }
  362.     rs.close();
  363.     stmt.close();
  364.     Student.avgTop10=df.format(f10/i10);
  365.     Student.avgTop30=df.format(f30/i30);
  366.     if(debug){
  367.         out.print("<br>Query student's position: sql="+sql);
  368.     }
  369.     }
  370.     catch(SQLException se){
  371.         out.print("<br> Query student's position sql="+sql);
  372.         out.print("<br>"+se.toString());
  373.     }
  374.     catch(Exception e){
  375.         out.print("<br> Query student's total position sql="+sql);
  376.         out.print("<br>"+e.toString());
  377.     }
  378.     //各科目的成绩单
  379.     sql=" SELECT  test.paper as testpaper,test.testnum as testnum,mn_scores.test_rs,`subject`.`id` AS  `subid`,`subject`.`Name` AS `subname`,  FORMAT(`test`.`mark`,0) AS `totalmark`,  FORMAT(`mn_scores`.`score`,0) AS `score` "+
  380.         " FROM  `mn_scores`  LEFT OUTER JOIN `subject` ON (`mn_scores`.`sub_id` = `subject`.`ID`)"+
  381.         " LEFT JOIN `test` ON (`mn_scores`.`test_id` = `test`.`id`)"+
  382.         " WHERE  (`mn_test_id` = "+mnTest.id+") AND (`stu_id` = '"+Student.id+"')"+
  383.         " ORDER BY `subid`";
  384.     try{
  385.         stmt=con.createStatement();
  386.         rs=stmt.executeQuery(sql);
  387.         String temp=null;
  388.         String [] arrtemp=null;
  389.         String [] tests=null;
  390.         while(rs.next()){
  391.             Subject s=new Subject();
  392.             s.sub_id=rs.getInt("subid");
  393.             s.name=rs.getString("subname");
  394.             s.totalMark=rs.getString("totalmark");
  395.             s.realMark=rs.getString("score");
  396.             s.testnum=rs.getInt("testnum");
  397.             //处理试题信息
  398.             temp=rs.getString("testpaper");
  399.             tests=temp.split("#");
  400.             StringBuffer Answer=new StringBuffer();
  401.             StringBuffer Mark=new StringBuffer();
  402.             StringBuffer Dif=new StringBuffer();
  403.             StringBuffer testIDs=new StringBuffer();
  404.             StringBuffer Rate=new StringBuffer();
  405.             for(i=0;i<s.testnum;i++){
  406.                 //取回试题号
  407.                 arrtemp=tests[i].split("@");
  408.                 testIDs.append(arrtemp[0]+",");//题号
  409.                 Rate.append(T_Question.getCorrectRate(con,Integer.parseInt(arrtemp[0]))+",");
  410.                 Answer.append(arrtemp[1]+",");//答案
  411.     Mark.append(arrtemp[2]+",");
  412.                 Dif.append(arrtemp[3]+",");
  413.             }
  414.             s.arrAnswer=Answer.toString().split(",");
  415.             s.arrDif=Dif.toString().split(",");
  416.             s.arrMark=Mark.toString().split(",");
  417.             s.arrID=testIDs.toString().split(",");
  418.             s.arrRate=Rate.toString().split(",");
  419.             Answer=null;
  420.             Mark=null;
  421.             Dif=null;
  422.             testIDs=null;
  423.             //处理科目考试结果
  424.             temp=rs.getString("test_rs");
  425.             arrtemp=temp.split("#");
  426.             //s.arrAnswer=arrtemp[0].split(",");
  427.             //s.arrMark=arrtemp[1].split(",");
  428.             s.arrSubAnswer=arrtemp[0].split(",");
  429.             s.arrTF=arrtemp[1].split(",");
  430.             //s.arrDif=arrtemp[4].split(",");
  431.             s.arrSubMark=arrtemp[2].split(",");
  432.             subs.addElement(s);
  433.         }
  434. rs.close();
  435.         stmt.close();
  436.         if(debug){
  437.             out.print("<br>subject info sql="+sql);
  438.             out.print("<br>subject info="+subs.toString());
  439.         }
  440.     }
  441.     catch(SQLException se){
  442.         out.print("<br> subject info error sql="+sql);
  443.         out.print("<br>"+se.toString());
  444.     }
  445.     catch(Exception e){
  446.         out.print("<br> subject info error sql="+sql);
  447.         out.print("<br>"+e.toString());
  448.     }
  449.     //科目的平均
  450.     try{
  451.         //分校平均
  452.         sql="SELECT   `UserInfo`.`jh_area`,  `mn_history`.`mn_test_id`,  `mn_scores`.`sub_id`,"+
  453.         "  FORMAT(AVG(`mn_scores`.`score`),2) AS `score_avg`"+
  454.         "  FROM  `mn_history` "+
  455.         "  LEFT OUTER JOIN `mn_scores` ON (`mn_history`.`stu_id` = `mn_scores`.`stu_id`) "+
  456.         "  AND (`mn_history`.`mn_test_id` = `mn_scores`.`mn_test_id`)"+
  457.         "  LEFT OUTER JOIN `UserInfo` ON (`mn_history`.`stu_id` = `UserInfo`.`vcUserNo`) "+
  458.         "  WHERE"+
  459.         "  (`UserInfo`.`jh_area` = '"+Student.jh_area+"') AND "+
  460.         "  (`mn_history`.`mn_test_id` = "+mnTest.id+") "+
  461.         "  GROUP BY  `UserInfo`.`jh_area`,  `mn_history`.`mn_test_id`,  `mn_scores`.`sub_id`"+
  462.         "  ORDER BY  `mn_scores`.`sub_id`";
  463.         stmt=con.createStatement();
  464.         rs=stmt.executeQuery(sql);
  465.         i=0;
  466.         Subject s=null;
  467.         while(rs.next()){
  468.             s=(Subject)subs.elementAt(i);
  469.             s.avgArea=rs.getString("score_avg");
  470.             i++;
  471.         }
  472. rs.close();
  473.         stmt.close();
  474.         if(debug){
  475.             out.print("<br>subject area_avg sql="+sql);
  476.             out.print("<br>subject info="+subs.toString());
  477.         }
  478.         //全体平均
  479.         sql="SELECT  `mn_scores`.`mn_test_id`,  `mn_scores`.`sub_id`,"+
  480.         "  FORMAT(AVG(`mn_scores`.`score`),2) AS `score_avg`"+
  481.         "  FROM  mn_history LEFT OUTER JOIN mn_scores ON(mn_history.stu_id=mn_scores.stu_id) "+
  482.         "  AND (`mn_history`.`mn_test_id` = `mn_scores`.`mn_test_id`)"+
  483.         "  WHERE mn_history.mn_test_id="+mnTest.id+
  484.         "  GROUP BY   `mn_scores`.`mn_test_id`,  `mn_scores`.`sub_id`"+
  485.         "  ORDER BY   `mn_scores`.`sub_id`";
  486.         stmt=con.createStatement();
  487.         rs=stmt.executeQuery(sql);
  488.         i=0;
  489.         s=null;
  490.         while(rs.next()){
  491.             s=(Subject)subs.elementAt(i);
  492.             s.avgTotal=rs.getString("score_avg");
  493.             i++;
  494.         }
  495. rs.close();
  496.         stmt.close();
  497.         if(debug){
  498.             out.print("<br>subject total sql="+sql);
  499.             out.print("<br>subject info="+subs.toString());
  500.         }
  501.     }
  502.     catch(SQLException se){
  503.         out.print("<br> subject total error sql="+sql);
  504.         out.print("<br>"+se.toString());
  505.     }
  506.     catch(Exception e){
  507.         out.print("<br> subject total error sql="+sql);
  508.         out.print("<br>"+e.toString());
  509.     }
  510.     //10% top 30% top
  511.     //
  512.     DecimalFormat df=new DecimalFormat("####.##");
  513.     for(j=0;j<subs.size();j++){
  514.     //每一科目
  515.     Subject s=(Subject)subs.elementAt(j);
  516.     try{
  517.         sql="  SELECT mn_history.mn_test_id,mn_history.stu_id, mn_scores.score, mn_scores.sub_id "+
  518.             "  FROM  mn_history LEFT OUTER JOIN mn_scores ON(mn_history.stu_id=mn_scores.stu_id) "+
  519.             "  AND (`mn_history`.`mn_test_id` = `mn_scores`.`mn_test_id`)"+
  520.             "  WHERE mn_history.mn_test_id="+mnTest.id+
  521.             "  AND  sub_id="+s.sub_id+
  522.             "  ORDER BY mn_scores.score DESC";
  523.         stmt=con.createStatement();
  524.         rs=stmt.executeQuery(sql);
  525.         //top10
  526.         i10=Math.round(mnTest.testPeople *0.1);
  527.         i30=Math.round(mnTest.testPeople *0.3);
  528.         if(i10==0) i10=1;
  529.         if(i30==0) i30=1;
  530.         f10=0;
  531.         f30=0;
  532.         if(debug){
  533.             out.print("<br><br><br>Begin:j="+j+"<br>sub_name="+s.name +
  534.             "<br>f10="+f10+"<br>i30="+i30+"<br>f30="+f30);
  535.         }
  536.         i=0;
  537.         int tempPos=1;
  538.          float fmark=Float.MAX_VALUE;
  539.         float tempf=0;
  540.         float realf=Float.parseFloat(s.realMark);
  541.         if(debug){
  542.             out.print("<br>top10-top30:"+
  543.                 "<br>i10="+i10+
  544.                 "<br>i30="+i30);
  545.         }
  546.         while(rs.next()){
  547.             tempf=rs.getFloat("score");
  548.             if(debug){
  549.                 out.print("<br>sub_real_mark="+realf+
  550.                 "<br>rs:score="+tempf);
  551.             }
  552.             i++;
  553.             if(i<=i10)
  554.                 f10+=tempf;
  555.             if(i<=i30)
  556.                 f30+=tempf;
  557.             if(tempf==realf){
  558.                         s.posAll=String.valueOf(tempPos);
  559.                         if(mnTest.testPeople<=100)
  560.                             s.posPercent=s.posAll;
  561.                         else
  562.                             s.posPercent=String.valueOf(100*tempPos/mnTest.testPeople);
  563.             }
  564.             else if(fmark>tempf){
  565.                 tempPos++;
  566.                 fmark=tempf;
  567.            }
  568.         }
  569.         if(debug){
  570.             out.print("<br>end:i10="+i10+"<br>f10="+f10+"<br>i30="+i30+
  571.                 "<br>f30="+f30+"<br>posall="+s.posAll);
  572.         }
  573.         rs.close();
  574.         stmt.close();
  575.         df=new DecimalFormat("####.00");
  576.         s.avgTop10=df.format(f10/i10);
  577.         s.avgTop30=df.format(f30/i30);
  578.         if(debug){
  579.             out.print("<br>avgTop10="+s.avgTop10+"<br>avgTop30="+s.avgTop30);
  580.             out.print("<br>subject top10-30 sql="+sql);
  581.         }
  582.     }
  583.     catch(SQLException se){
  584.         out.print("<br> subject info error sql="+sql);
  585.         out.print("<br>"+se.toString());
  586.     }
  587.     catch(Exception e){
  588.         out.print("<br> subject info error sql="+sql);
  589.         out.print("<br>"+e.toString());
  590.     }
  591.     }//end for
  592.     //更新历史记录
  593.     //先将这次查询的结果存入mn_history
  594.     try{
  595.         sql=" select * from mn_history where mn_test_id="+mnTest.id+
  596.             " and stu_id='"+Student.id+"'";
  597.         stmt=con.createStatement();
  598.         rs=stmt.executeQuery(sql);
  599.         if(rs.next()){
  600.             rs.close();
  601.             stmt.close();
  602.             StringBuffer sb=new StringBuffer();
  603.             for(i=0;i<subs.size();i++){
  604.                 Subject s=(Subject)subs.elementAt(i);
  605.                 sb.append(s.name+":"+s.realMark+"#");
  606.                 }
  607.             sql=" update mn_history set totalmark="+Student.total_mark+","+
  608.                 " submark='"+sb.toString()+"',test_date='"+Student.test_date+"',"+
  609.                 " sub_num="+mnTest.sub_num+","+
  610.                 " totalpeople="+mnTest.testPeople+","+
  611.                 " position="+Student.posAll+","+
  612.                 " top10avg="+Student.avgTop10+","+
  613.                 " top30avg="+Student.avgTop30+
  614.                 " where stu_id='"+Student.id+"' and mn_test_id="+mnTest.id;
  615.             stmt=con.createStatement();
  616.             stmt.executeUpdate(sql);
  617.             if(debug) out.println("<br>update mn_history sql="+sql);
  618.             stmt.close();
  619.         }
  620.         else{
  621.             //将新记录插入数据库
  622.             rs.close();
  623.             stmt.close();
  624.             StringBuffer sb=new StringBuffer();
  625.             for(i=0;i<subs.size();i++){
  626.                 Subject s=(Subject)subs.elementAt(i);
  627.                 sb.append(s.name+":"+s.realMark+"#");
  628.                 }
  629.             sql=" insert into mn_history(stu_id,mn_test_id,totalmark,submark,test_date,sub_num,"+
  630.                 " position,top10avg,top30avg,testpeople) "+
  631.                 " values('"+Student.id+"',"+mnTest.id+","+Student.total_mark+",'"+
  632.                     sb.toString()+"','"+Student.test_date+"',"+mnTest.sub_num+","+
  633.                     Student.posAll+","+Student.avgTop10+","+Student.avgTop30+","+mnTest.testPeople+")";
  634.             stmt=con.createStatement();
  635.             stmt.executeUpdate(sql);
  636.             stmt.close();
  637.         }
  638.     }catch(SQLException se){
  639.         out.print("<br> insert into mn_history sql="+sql);
  640.         out.print("<br>"+se.toString());
  641.     }
  642.     catch(Exception e){
  643.         out.print("<br> insert into mn_history sql="+sql);
  644.         out.print("<br>"+e.toString());
  645.     }
  646.     //从mn_history中选取记录 stu_id,mn_test_id,totalmark,submark,test_date
  647.      try{
  648.  
  649.   sql="SELECT   MAX(`mn_history`.`sub_num`) AS `maxsub` FROM  `mn_history`"+
  650. " WHERE  (stu_id = '"+Student.id+"')";
  651. stmt=con.createStatement();
  652.         rs=stmt.executeQuery(sql);
  653.         
  654.         if(rs.next())
  655.           maxHisSubNum=rs.getInt("maxsub");
  656. else
  657. maxHisSubNum=0;
  658. rs.close();
  659. stmt.close();
  660.         sql=" SELECT   `mn_test`.`sub_num`,`mn_test`.`testpeople`,`mn_history`.`totalpeople`,  "+
  661.             " `mn_history`.`mn_test_id`,  `mn_history`.`totalmark`,  `mn_history`.`position`,"+
  662.             " `mn_history`.`top10avg`,  `mn_history`.`top30avg`,  `mn_history`.`submark`,"+
  663.             " DATE_FORMAT(`mn_history`.`test_date`,"%Y-%m-%e") AS `test_date`, "+
  664.             " `mn_history`.`stu_id` "+
  665.             " FROM  `mn_history`  LEFT OUTER JOIN `mn_test` ON (`mn_history`.`mn_test_id` = `mn_test`.`id`)"+
  666.             " WHERE  (`mn_history`.`stu_id` = '"+Student.id+"')"+" AND (`mn_test`.`grade_note` = '"+gradenote +"')"+
  667.             " ORDER BY  `test_date` DESC";
  668.         stmt=con.createStatement();
  669.         rs=stmt.executeQuery(sql);
  670.         hisRS=new Vector();
  671.         if(debug)
  672.             out.print("<br> query mn_history sql="+sql);
  673.         String submarks;
  674.         while(rs.next()){
  675.         //构造一条历史记录/
  676.             History h=new History();
  677.             h.sub_num=rs.getInt("sub_num");
  678.             h.testdate=rs.getString("test_date");
  679.             h.mn_test_id=rs.getString("mn_test_id");
  680.             h.stu_id=rs.getString("stu_id");
  681.             h.totalmark=rs.getInt("totalmark");
  682.             submarks=rs.getString("submark");
  683.             h.sub_marks=submarks.split("#");
  684.             if(rs.getInt("testpeople")==rs.getInt("totalpeople")){
  685.                 //模拟考试的总人数没有变化
  686.                 h.top10avg=rs.getString("top10avg");
  687.                 h.top30avg=rs.getString("top30avg");
  688.                 h.position=rs.getString("position");
  689.                 h.testPeople=rs.getInt("totalpeople");
  690.             }
  691.             else{
  692.             //历史排名 //重新求排名
  693.             h.testPeople=rs.getInt("testpeople");
  694.             i10=Math.round(h.testPeople *0.1);//top10
  695.             i30=Math.round(h.testPeople *0.3);
  696.             if(i10==0) i10=1;
  697.             if(i30==0) i30=1;
  698.             f10=0;
  699.             f30=0;
  700.         try{
  701.             sql=" SELECT mn_history.stu_id,mn_history.mn_test_id,  FORMAT(SUM(mn_scores.score),0) AS totalmark"+
  702.                 " FROM  mn_history LEFT OUTER JOIN mn_scores ON(mn_history.stu_id=mn_scores.stu_id) "+
  703.                 " AND (`mn_history`.`mn_test_id` = `mn_scores`.`mn_test_id`)"+
  704.                 " WHERE mn_history.mn_test_id="+h.mn_test_id+
  705.                 " GROUP BY mn_history.stu_id,mn_history.mn_test_id"+
  706.                 " ORDER BY  totalmark desc";
  707.             Statement tempstmt=con.createStatement();
  708.             ResultSet temprs=tempstmt.executeQuery(sql);
  709.             i=0;
  710.             int imark=0;
  711.             int tempPos=1;
  712.             float fmark=0;
  713.             int tmark=Integer.MAX_VALUE;
  714.             while(temprs.next()){
  715.                 i++;
  716.                 imark=temprs.getInt("totalmark");
  717.                 fmark=temprs.getFloat("totalmark");
  718.                 if(i<=i10)
  719.                     f10+=fmark;
  720.                 if(i<=i30)
  721.                     f30+=fmark;
  722.                 //查找分数的排名
  723.                 if(debug){
  724.                     out.print("<br><br>history student totalmark="+Student.total_mark +
  725.                         "<br>sql totalmark="+temprs.getInt("totalmark"));
  726.                 }
  727.                 if(h.totalmark==imark){
  728.                     h.position=String.valueOf(tempPos);
  729.                     //Student.posAll=tempPos;
  730.                 }
  731.                 else if(tmark>imark){//分数不同
  732.                     tempPos++;
  733.                     tmark=imark;
  734.                 }
  735.             }//end while
  736.             temprs.close();
  737.             tempstmt.close();
  738.             df=new DecimalFormat("####.00");
  739.             h.top10avg=df.format(f10/i10);
  740.             h.top30avg=df.format(f30/i30);
  741.             if(debug){
  742.                 out.print("<br>Query history student's position: sql="+sql);
  743.             }
  744.         }
  745.         catch(SQLException se){
  746.             out.print("<br> Query history student's position sql="+sql);
  747.             out.print("<br>"+se.toString());
  748.         }
  749.         catch(Exception e){
  750.             out.print("<br> Query history student's total position sql="+sql);
  751.             out.print("<br>"+e.toString());
  752.         }
  753.         //将查询回的信息写入数据库
  754.         try{
  755.             sql=" update mn_history set "+
  756.                 " totalpeople="+h.testPeople+","+
  757.                 " position="+h.position+","+
  758.                 " top10avg="+h.top10avg+","+
  759.                 " top30avg="+h.top30avg+
  760.                 " where stu_id='"+Student.id+"' and mn_test_id="+mnTest.id;
  761.             stmt=con.createStatement();
  762.             stmt.executeUpdate(sql);
  763.             if(debug) out.println("<br> update mn_history sql="+sql);
  764.         }
  765.         catch(SQLException se){
  766.             out.print("<br> update history  position sql="+sql);
  767.             out.print("<br>"+se.toString());
  768.         }
  769.         catch(Exception e){
  770.             out.print("<br> update history  position sql="+sql);
  771.             out.print("<br>"+e.toString());
  772.         }
  773.         }//end else
  774.         hisRS.addElement(h);
  775.         }//end while
  776.     }catch(SQLException se){
  777.         out.print("<br> select from mn_history error sql="+sql);
  778.         out.print("<br>"+se.toString());
  779.     }
  780.     catch(Exception e){
  781.         out.print("<br> select from mn_history error sql="+sql);
  782.         out.print("<br>"+e.toString());
  783.     }
  784.     %>
  785. <HTML><HEAD><TITLE>模拟考试成绩查询</TITLE>
  786. <META http-equiv=Content-Type content="text/html; charset=gb2312">
  787. <META content="MSHTML 6.00.2462.0" name=GENERATOR>
  788. <style media="print">
  789. .noprint { display: none }
  790. </style>
  791. </HEAD>
  792. <BODY>
  793. <table width="107%" height=440 border=0 align="center" bordercolor=#d3add1>
  794.   <tbody>
  795.       <tr>
  796.         <td height="32" align="center" valign=middle><strong><font size="+2" face="宋体">个人成绩单(表)</font></strong>
  797.         </td>
  798.       </tr>
  799.       <tr>
  800.         <td height="43" align="center" valign=middle><table width="100%" border="0">
  801.           <tr>
  802.             <td width="44%" height="20" nowrap>考试名称:&nbsp;</td>
  803.             <td width="13%">&nbsp;</td>
  804.             <td width="43%" height="20" nowrap>
  805.               <div align="left">共创教育研究院</div></td>
  806.           </tr>
  807.           <tr>
  808.             <td height="20"><%--=Student.jh_area--%>
  809.               <%=mnTest.name%></td>
  810.             <td>&nbsp;</td>
  811.             <td width="43%" height="20" nowrap>
  812.               <div align="left">电话:010-68130545</div></td>
  813.           </tr>
  814.           <tr>
  815.             <td height="20"><em></em><%--=Student.school--%></em></td>
  816.             <td>&nbsp;</td>
  817.             <td width="43%" height="20" nowrap>
  818.               <div align="left">网址:cosoft.org.cn</div></td>
  819.           </tr>
  820.         </table></td>
  821.       </tr>
  822.       <tr>
  823.         <td height="168" align="center" valign="top"><table width="100%" border="1" cellpadding="0" cellspacing="0">
  824.             <tr>
  825.             <td height="24" width="20%">
  826.               <div align="center">所属</div></td>
  827.               <td width="20%"><div align="center">姓名</div></td>
  828.               <td width="20%"><div align="center">学号</div></td>
  829.               <td width="20%"><div align="center">年级</div></td>
  830.               <td width="20%"><div align="center">考试日期</div></td>
  831.             </tr>
  832.             <tr>
  833.             <td height="24" nowrap>
  834.               <div align="center"><%--=Student.jh_area_sch--%><%=Student.school%></div></td>
  835.               <td><div align="center"><%=Student.name%></div></td>
  836.               <td><div align="center"><%=Student.id%></div></td>
  837.               <td><div align="center"><%=Student.grade%></div></td>
  838.               <td><div align="center"><%=Student.test_date%></div></td>
  839.             </tr>
  840.           </table>
  841.           <div align="left"><br>
  842.             成绩和排名:</div>
  843.           <table width="100%" border="1" cellpadding="0" cellspacing="0">
  844.             <tr>
  845.             <td height="24" width="21%">
  846.               <div align="center">成绩</div></td>
  847.               <td width="14%"><div align="center">10%平均</div></td>
  848.               <td width="14%"><div align="center">30%平均</div></td>
  849.               <td width="32%"> <div align="center" width="33%">全部参加人员排名</div></td>
  850.               <td width="19%"> <div align="center" width"33%">100人换算排名</div></td>
  851.             </tr>
  852.             <tr valign="middle">
  853.             <td height="24" nowrap>
  854.               <div align="center"><%=Student.total_mark%>分(满分<%=mnTest.totalMark%>分)</div></td>
  855.             <td nowrap>
  856. <div align="center"><%=Student.avgTop10%>分</div></td>
  857.               <td><div align="center"><%=Student.avgTop30%></div></td>
  858.             <td nowrap>
  859.               <div align="center"><%=Student.posAll%>名(全部参加排名者<%=mnTest.testPeople%>人)</div></td>
  860.             <td nowrap>
  861.               <div align="center"><%=Student.posPercent%></div></td>
  862.             </tr>
  863.           </table>
  864.           <div align="left"><br>
  865.             成绩单:</div>
  866.           <table width="100%" border="1" cellpadding="0" cellspacing="0">
  867.             <tr>
  868.             <td width="12%" height="24">&nbsp;</td>
  869.             <td width="11%" nowrap>
  870. <div align="center">分数</div></td>
  871.             <td width="11%" nowrap>
  872. <div align="center">得分</div></td>
  873.             <!--td width="11%" nowrap>
  874. <div align="center">分校平均</div></td-->
  875.             <td width="11%" nowrap>
  876. <div align="center">全体平均</div></td>
  877.             <td width="11%" nowrap>
  878. <div align="center">10%平均</div></td>
  879.             <td width="11%" nowrap>
  880. <div align="center">30%平均</div></td>
  881.             <td width="11%" nowrap>
  882. <div align="center">总排名</div></td>
  883.             <td width="11%" nowrap>
  884. <div align="center">100名排名</div></td>
  885.             </tr>
  886.             <%
  887.               for(i=0;i<subs.size();i++){
  888.                 Subject s=(Subject)subs.elementAt(i);
  889.               %>
  890.             <tr valign="middle">
  891.             <td height="24" nowrap >
  892.               <div align="center"><%=s.name%></div></td>
  893.             <td nowrap>
  894.               <div align="center"><%=s.totalMark%></div></td>
  895.             <td nowrap>
  896.               <div align="center"><%=s.realMark%></div></td>
  897.             <!--td nowrap>
  898. <div align="center"><%=s.avgArea%></div></td-->
  899.             <td nowrap>
  900. <div align="center"><%=s.avgTotal%></div></td>
  901.             <td nowrap>
  902. <div align="center"><%=s.avgTop10%></div></td>
  903.             <td nowrap>
  904. <div align="center"><%=s.avgTop30%></div></td>
  905.             <td nowrap>
  906. <div align="center"><%=s.posAll%></div></td>
  907.             <td nowrap>
  908. <div align="center"><%=s.posPercent%></div></td>
  909.             </tr>
  910.             <%}%>
  911.           </table>
  912.   <div align="left"><br>
  913.             判分表及难易度:准确率 A(0~20%)、B(21~40%)、C(41~60%)、D(61~80%)、E(81~100%) :</div>
  914.             <%
  915.             df=new DecimalFormat("00");
  916.             for(i=0;i<subs.size();i++){
  917.                 Subject s=(Subject)subs.elementAt(i);
  918.                 colwidth=" width=""+String.valueOf(80.00/s.testnum)+"%"";
  919.          %>
  920.           <table width="100%" border="1" cellspacing="0" cellpadding="0">
  921.             <tr>
  922.             <td width="8%" height="24" nowrap>
  923.               <div align="center"><strong><font size="+1">科目</font></strong></div></td>
  924.             <td width="92%" height="24" colspan="<%=s.testnum+1%>">&nbsp;
  925.             </td>
  926.             </tr>
  927.             <tr>
  928.               <td rowspan="8"  width="8%"><div align="center"><%=s.name%></div></td>
  929.             <td width="12%" height="20" nowrap>
  930.               <div align="center">题号</div></td>
  931.               <%for(j=1;j<=s.testnum;j++)
  932.                   out.println("<td "+colwidth+"><div align="center">"+df.format(j)+"</div></td>");
  933.               %>
  934.             </tr>
  935.             <tr>
  936.             <td   height="20" nowrap>
  937.               <div align="center">正确答案</div></td>
  938.               <%for(j=0;j<s.arrAnswer.length;j++)
  939.                   out.println("<td "+colwidth+"><div align="center">"+s.arrAnswer[j]+"</div></td>");
  940.               %>
  941.             </tr>
  942.             <tr>
  943.             <td   height="20" nowrap>
  944.               <div align="center">个人答案</div></td>
  945.               <%for(j=0;j<s.arrSubAnswer.length;j++)
  946.                   out.println("<td "+colwidth+"><div align="center">"+s.arrSubAnswer[j]+"</div></td>");
  947.               %>
  948.             </tr>
  949.             <tr>
  950.             <td height="20"  >
  951.               <div align="center">对错</div></td>
  952.               <%for(j=0;j<s.arrTF.length;j++)
  953.                   out.println("<td "+colwidth+"><div align="center">"+s.arrTF[j]+"</div></td>");
  954.               %>
  955.             </tr>
  956.             <tr>
  957.             <td height="20" nowrap>
  958.               <div align="center">分值</div></td>
  959.               <%for(j=0;j<s.arrMark.length;j++)
  960.                   out.println("<td "+colwidth+"><div align="center">"+s.arrMark[j]+"</div></td>");
  961.               %>
  962.             </tr>
  963.             <tr>
  964.             <td  height="20" nowrap>
  965.               <div align="center">得分</div></td>
  966.                <%for(j=0;j<s.arrSubMark.length;j++)
  967.                   out.println("<td "+colwidth+"><div align="center">"+s.arrSubMark[j]+"</div></td>");
  968.               %>
  969.             </tr>
  970.             <tr>
  971.             <td  height="20" nowrap>
  972.               <div align="center">难易度</div></td>
  973.               <%for(j=0;j<s.arrDif.length;j++)
  974.                   out.println("<td "+colwidth+"><div align="center">"+s.arrDif[j]+"</div></td>");
  975.               %>
  976.             </tr>
  977.             <tr>
  978.             <td  height="20" nowrap>
  979.               <div align="center">准确率</div></td>
  980.               <%for(j=0;j<s.arrDif.length;j++)
  981.                   out.println("<td "+colwidth+"><div align="center">"+s.arrRate[j]+"</div></td>");
  982.               %>
  983.             </tr>
  984.           </table>
  985.           <%}//end for 科目判分%>
  986.           <div align="left"><br>
  987.             历史记录 :</div>
  988.         <%
  989.         colwidth=" width=""+String.valueOf(88.00/(maxHisSubNum+4))+"%"";
  990.         %>
  991.           <table width="100%" border="1" cellpadding="0" cellspacing="0">
  992.             <tr>
  993.             <td width="12%" height="24" nowrap>
  994.               <div align="center"><strong>考试日期</strong></div></td>
  995.               <td <%=colwidth%> nowrap><div align="center"><strong>总分</strong></div></td>
  996.               <td <%=colwidth%> nowrap><div align="center"><strong>10%平均</strong></div></td>
  997.               <td <%=colwidth%> nowrap><div align="center"><strong>30%平均</strong></div></td>
  998.               <td <%=colwidth%> nowrap><div align="center"><strong>排名</strong></div></td>
  999.               <%
  1000.                /*
  1001.     for(i=0;i<subs.size();i++){
  1002.                     out.println("<td "+colwidth+" nowrap><div align="center"><strong>"+
  1003.                         ((Subject)subs.elementAt(i)).name+"</div></td>");
  1004.                 }
  1005. */
  1006. for(i=0;i<maxHisSubNum;i++){
  1007.                     out.println("<td "+colwidth+" nowrap>&nbsp;</td>");
  1008.                 }
  1009.               %>
  1010.             </tr>
  1011.             <%for(i=0;i<hisRS.size();i++){
  1012.                 History h=(History)hisRS.elementAt(i);
  1013.             %>
  1014.             <tr>
  1015.             <td height="20" nowrap>
  1016.               <div align="center"><%=h.testdate%></div></td>
  1017.               <td nowrap>
  1018. <div align="center"><%=h.totalmark%></div></td>
  1019.               <td nowrap>
  1020. <div align="center"><%=h.top10avg%></div></td>
  1021.               <td nowrap>
  1022. <div align="center"><%=h.top30avg%></div></td>
  1023.               <td nowrap>
  1024. <div align="center"><%=h.position%></div></td>
  1025.                 <%for(j=0;j<h.sub_num;j++)
  1026.                 {   String [] submark=h.sub_marks[j].split(":");
  1027.                     //out.println("<td><div align="center">"+submark[1]+"</div></td>");
  1028.                     out.println("<td nowrap><div align="center">"+h.sub_marks[j]+"</div></td>");
  1029.                 }
  1030. for(;j<maxHisSubNum;j++)
  1031. out.println("<td nowrap>&nbsp;</td>");
  1032.                 %>
  1033.             </tr>
  1034.             <%}%>
  1035.           </table>
  1036.           <br><br>
  1037. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  1038.             <tr>
  1039.               <td width="0%">&nbsp;</td>
  1040.               <td width="45%"><div align="right"><img src="<%= graphURLmn %>" width=350 height=250 border=0 ></div></td>
  1041.               <td width="8%">&nbsp;</td>
  1042.               <td width="47%"><img src="<%= graphURLstu %>" width=350 height=250 border=0 ></td>
  1043.             </tr>
  1044.             <tr>
  1045.               <td>&nbsp;</td>
  1046.               <td><div align="right"></div></td>
  1047.               <td>&nbsp;</td>
  1048.               <td>&nbsp;</td>
  1049.             </tr>
  1050.           </table>
  1051.         </td>
  1052.       </tr>
  1053.       <tr>
  1054.         <td align="center" valign=middle></td>
  1055.       </tr>
  1056.     </tbody>
  1057.   </table>
  1058.   </div>
  1059.   <P> </P>
  1060. <P>&nbsp;</P>
  1061. <P>&nbsp;</P>
  1062. </BODY></HTML>
  1063. <%
  1064. }
  1065. }
  1066. catch(Exception e){
  1067.     System.out.print(e.toString());
  1068. }
  1069. finally{
  1070.     DBCon.dropConnection();
  1071. }
  1072. %>