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

教育系统应用

开发平台:

WORD

  1. <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" %>
  2. <%@ page import="java.sql.*"%>
  3. <%@ page import="jinghua.*"%>
  4. <%@ page import="java.util.*"%>
  5. <%@ page import = "java.io.PrintWriter" %>
  6. <%@ page import = "jinghua.chart.servlet.WebHitChart" %>
  7. <%@ page import = "jinghua.chart.servlet.WebHitDataSet" %>
  8. <jsp:useBean id="DBCon" class="jinghua.JinghuaConn" scope="session">
  9. </jsp:useBean>
  10. <%!Connection con;
  11. boolean debug=false;
  12. class Student{
  13.     String id;
  14.     String name;
  15.     String mark;
  16.     public String toString(){
  17.         String temp="";
  18.         temp="<br> id="+id+"<br> name="+name;
  19.         return temp;
  20.    }
  21. };
  22. ArrayList students=null;
  23. Statement stmt=null;
  24. ResultSet rs=null;
  25. String sql="";
  26. String testname=null;
  27. int markbegin=0;
  28. int markend=0;
  29. long testid=0;
  30. %>
  31. <%
  32. try{
  33.  testid=Long.parseLong(request.getParameter("testid"));
  34.  markbegin=Integer.parseInt(request.getParameter("markbegin"));
  35.  markend=Integer.parseInt(request.getParameter("markend"));
  36. }
  37. catch(Exception e){
  38. Tools.debugPrintln(e.toString());
  39. throw new Exception("页面缺少调用参数!");
  40. }
  41. if(debug){
  42. out.print("<br>markbegin="+request.getParameter("markbegin"));
  43. out.print("<br>markend="+request.getParameter("markend"));
  44. out.print("<br>testid="+request.getParameter("testid"));
  45. }
  46. String filename = WebHitChart.generate_TestBarChart(testid, session, new PrintWriter(out));
  47. String graphURL = request.getContextPath() + "/servlet/DisplayChart?filename=" + filename;
  48. try{
  49.     con=DBCon.getConnection();
  50.     sql="SELECT   `test`.`title` FROM  `test`"+
  51.         " WHERE  (`test`.`id` = "+testid+")";
  52.     stmt=con.createStatement();
  53.     rs=stmt.executeQuery(sql);
  54.     if(rs.next())
  55.         testname=rs.getString("title");
  56.     else
  57.         testname="";
  58. //详细信息
  59. sql="SELECT   `scores`.`score`,  `userinfo`.`vcName`,  `scores`.`stu_id`"+
  60. " FROM  `scores`"+
  61. " LEFT OUTER JOIN `userinfo` ON (`scores`.`stu_id` = `userinfo`.`vcUserNo`)"+
  62. " WHERE  (`scores`.`test_id` ="+testid+") AND "+
  63. "  (`scores`.`score` >="+markbegin+") AND "+
  64. "  (`scores`.`score` <="+markend+")"+
  65.         "  ORDER BY `scores`.`score` DESC";
  66. if(debug) out.print("<br> info sql="+sql);
  67.     stmt=con.createStatement();
  68.     rs=stmt.executeQuery(sql);
  69. students=new ArrayList();
  70.     while(rs.next()){
  71.      Student s=new Student();
  72.         s.id=rs.getString("stu_id");
  73.         s.name=rs.getString("vcName");
  74.         s.mark=String.valueOf(rs.getInt("score"));
  75.         students.add(s);
  76.     }
  77.     rs.close();
  78.     stmt.close();
  79. %>
  80. <script language="JavaScript" type="text/JavaScript">
  81. function gotestpaper(){
  82. document.myform.method = "POST";
  83.     document.myform.action = "Query_test_unit.jsp?testID=<%=testid%>";
  84.     document.myform.target="_self";
  85.     document.myform.submit();
  86. }
  87. </script>
  88. <HTML>
  89. <HEAD>
  90. <META http-equiv=Content-Type content="text/html; charset=gb2312">
  91. <TITLE>共创学堂-模拟考试成绩查询</TITLE>
  92. <SCRIPT language=JavaScript>
  93. <!--
  94. function SymError()
  95. {
  96.   return true;
  97. }
  98. window.onerror = SymError;
  99. //-->
  100. </SCRIPT>
  101. <!-- saved from url=(0041)http://jsptestonline.cosoft.org.cn/senior/none_xt.jsp -->
  102. <META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
  103. href="../errorpad/style/style.css" type=text/css rel=stylesheet>
  104. <META content="MSHTML 6.00.2462.0" name=GENERATOR>
  105. <link rel="stylesheet" type="text/css" href="../css.css">
  106. </HEAD>
  107. <BODY bgColor=#ffffff text=#000000 onLoad="InitMyform()">
  108. <CENTER>
  109.   <FORM name="myform" id="myform">
  110.     <TABLE cellSpacing=0 cellPadding=0 width=650 border=0>
  111.   <TBODY>
  112.   <TR>
  113.           <TD><IMG height=27 src="../errorpad/images/test_pop_01.gif" width=102></TD>
  114.           <TD align=right><IMG height=27 src="../errorpad/images/test_pop_02.gif"
  115.       width=134></TD>
  116.         </TR></TBODY></TABLE>
  117.   <p><strong><font color="#3366FF" size="+2" face="黑体">共创学堂考试成绩查询结果</font></strong>
  118.     <!--begin test -->
  119.   </p>
  120.   <p> <strong> </strong> <strong><%=testname%></strong> </p>
  121.   <TABLE width=100% height="60" border=0 cellPadding=0 cellSpacing=0>
  122.     <TBODY>
  123.       <TR>
  124.         <TD height="75"  align=middle> <table width="630" height="405" border="0" align="center" cellspacing="1" bordercolor="#799AE1" id="AutoNumber3" style="border-collapse: collapse">
  125.             <tr valign="middle">
  126.               <td> <p align="center">
  127. <img src="<%= graphURL %>" width=500 height=350 border=0 usemap="#<%= filename %>"></p></td>
  128.             </tr>
  129.             <tr valign="middle">
  130.               <td height="18" align="center" valign="middle" nowrap bgcolor="#FFFFFF">&nbsp;</td>
  131.             </tr>
  132.             <tr valign="middle">
  133.               <td height="20" align="center" valign="middle" nowrap bgcolor="#FFFFFF"><div align="left">
  134.                   <font size="+1">结果:分数在<strong><%=markbegin%></strong>和<strong><%=markend%></strong>之间的学生有<strong><%=students.size()%></strong>人</font></div></td>
  135.             </tr>
  136.           </table>
  137.           &nbsp;<br>
  138.           <TABLE width=630 border=1 align=center cellSpacing=1 bordercolor="#799AE1" style="border-collapse: collapse">
  139.             <TBODY>
  140. <TR>
  141.                 <th width="70" height=22 nowrap  class=l><strong>学号</strong></th>
  142.                 <th width="70" nowrap  class=l><strong>姓名</strong></th>
  143.                 <th width="70" nowrap  class=l><strong>分数</strong></th>
  144.                 <th width="70" nowrap  class=l><strong>学号</strong></th>
  145.                 <th width="70" nowrap  class=l><strong>姓名</strong></th>
  146.                 <th width="70" nowrap  class=l><strong>分数</strong></th>
  147.                 <th width="70" nowrap  class=l><strong>学号</strong></th>
  148.                 <th width="70" nowrap  class=l><strong>姓名</strong></th>
  149.                 <th width="70" nowrap  class=l><strong>分数</strong></th>
  150.               </TR>
  151.  <% Iterator iter = students.listIterator();
  152. while (iter.hasNext()) {%>
  153.               <TR>
  154.               <% Student s=(Student)iter.next();%>
  155.                 <td height=22 nowrap  class=l><div align="center"><%=s.id%></div></td>
  156.                 <td nowrap  class=l><div align="center"><%=s.name%></div></td>
  157.                 <td nowrap  class=l><div align="center"><%=s.mark%></div></td>
  158.                  <% if(iter.hasNext()){
  159.                  s=(Student)iter.next();%>
  160.                 <td height=22 nowrap  class=l><div align="center"><%=s.id%></div></td>
  161.                 <td nowrap  class=l><div align="center"><%=s.name%></div></td>
  162.                 <td nowrap  class=l><div align="center"><%=s.mark%></div></td>
  163.                 <%}else{%>
  164.                 <td nowrap  class=l><div align="center"></div></td>
  165.                 <td nowrap  class=l><div align="center"></div></td>
  166.                 <td nowrap  class=l><div align="center"></div></td>
  167.                 <%}%>
  168.                 <% if(iter.hasNext()){
  169.                  s=(Student)iter.next();%>
  170.                 <td height=22 nowrap  class=l><div align="center"><%=s.id%></div></td>
  171.                 <td nowrap  class=l><div align="center"><%=s.name%></div></td>
  172.                 <td nowrap  class=l><div align="center"><%=s.mark%></div></td>
  173.                 <%}else{%>
  174.                 <td nowrap  class=l><div align="center"></div></td>
  175.                 <td nowrap  class=l><div align="center"></div></td>
  176.                 <td nowrap  class=l><div align="center"></div></td>
  177.                 <%}%>
  178.               </TR>
  179. <%}%>
  180.             </TBODY>
  181.           </TABLE>
  182.           <p align="center"> 
  183.             <input name="goback" type="button" class="s03" id="goback"  onClick="gotestpaper()" value="返回">
  184.           </p>
  185.           <p>&nbsp;</p></TD>
  186.       </TR>
  187.     </TBODY>
  188.   </TABLE>
  189.   </FORM>
  190.   <div align="center"></div>
  191.   <p>
  192.     <input name="stu_id" type="hidden" id="studentid2" value="">
  193.   <!--end test -->
  194.   <!--begin bottom -->
  195.   <!--end bottom -->
  196. </CENTER>
  197. </BODY>
  198. </HTML>
  199. <%}
  200. catch(SQLException se){
  201.     out.println("<br>sql="+sql);
  202.     out.println("<br>"+se.toString());
  203. }
  204. catch(Exception e){
  205.     out.print(e.toString());
  206. }
  207. finally{
  208.     DBCon.dropConnection();
  209. }
  210. %>