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