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

教育系统应用

开发平台:

WORD

  1. <%@ page contentType="text/html; charset=gb2312" language="java"%>
  2. <%@ page import="java.sql.*" %>
  3. <%@ page import="jinghua.*"%>
  4. <jsp:useBean id="DBCon" class="jinghua.JinghuaConn" scope="session">
  5. </jsp:useBean>
  6. <%!Connection con;
  7. boolean debug=false;
  8. String studentID="";
  9. String gradenote="";
  10. Statement stmt=null;
  11. ResultSet rs=null;
  12. String sql="";
  13. %>
  14. <%
  15. try{
  16.     studentID=(String)session.getAttribute("studentID");
  17.     if(studentID==null){
  18.         throw new Exception();
  19.     }
  20. }catch(Exception e){
  21.     Tools.showalert("您还没有登录,或连接超时,请重新登录!",out);
  22.    Tools.showJS("window.open('../login.jsp','_self')",out);
  23. }
  24. try{
  25.     con=DBCon.getConnection();
  26.     //获取学生的年级信息
  27.     //sql="select id,gradenote,grade.Name as gn "+
  28.     //"from student  INNER JOIN grade ON (student.gradenote = grade.note) "+
  29.     //" where stuid='"+studentID+"'";
  30.     sql="select id,gradenote from UserInfo where vcUserNo='"+studentID+"'";
  31.     try{
  32.         stmt=con.createStatement();
  33.         rs=stmt.executeQuery(sql);
  34.         if(rs.next()){
  35.             gradenote=rs.getString("gradenote");
  36.             rs.close();
  37.             stmt.close();
  38.         }
  39.         if(debug){
  40.             out.print("<br>stuID="+studentID+"<br>gradenote="+gradenote);
  41.         }
  42.     }
  43.     catch(SQLException se){
  44.         out.print("<br> query student error sql="+sql);
  45.         out.print("<br>"+se.toString());
  46.     }
  47.     catch(Exception e){
  48.         out.print("<br> query student error sql="+sql);
  49.         out.print("<br>"+e.toString());
  50.     }
  51.     //--年级,科目,知识点三个下拉列表框联动-->
  52.     out.print(Tools.sub_know(con));
  53.     out.print(Tools.grade_sub(con));
  54. }
  55. catch(Exception e){
  56.     System.out.print(e.toString());
  57. }
  58. finally{
  59.     DBCon.dropConnection();
  60. }
  61. %>
  62. <!--年级,科目,知识点三个下拉列表框联动-->
  63. <script language="JavaScript">
  64. function changegs(locationid){
  65. document.myform.Subject.length =1;
  66.         document.myform.KnowPoint.length =1;
  67.         var locationid=locationid;
  68.         var i;
  69.         for (i=0;i < gscount; i++){
  70.             if (grade_sub[i][0] == locationid) {
  71.             document.myform.Subject.options[document.myform.Subject.length] = new Option(grade_sub[i][2], grade_sub[i][1]);
  72.             }
  73. }
  74. }
  75. function changesk(locationid){
  76. document.myform.KnowPoint.length =1;
  77. var locationid=locationid;
  78. var i;
  79. for (i=0;i < gskcount; i++){
  80. if (grade_sub_know[i][1] == locationid){
  81. document.myform.KnowPoint.options[document.myform.KnowPoint.length] = new Option(grade_sub_know[i][3], grade_sub_know[i][2]);
  82. }
  83. }
  84. }
  85. function InitForm(){
  86.     changegs('<%=gradenote%>')
  87. }
  88. </script>
  89. <html>
  90. <head>
  91. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  92. <title>精化学堂-自由测试</title>
  93. <link rel="stylesheet" type="text/css" href="../css.css">
  94. </head>
  95. <body bgcolor="#C8D6F0" onLoad="InitForm()">
  96. <FORM action="free_test_paper.jsp" method="post" name="myform" target="_blank" id="myform">
  97.   <table width="400" height="175" border="1" align="center" cellspacing="1" bordercolor="#799AE1" id="AutoNumber3" style="border-collapse: collapse">
  98.     <tr>
  99.       <td height="35" colspan="5" align="center" valign="baseline" nowrap background="images/admin_bg_1.gif" bgcolor="#FFFDE8"><font size="+1"><strong>请选择测验内容</strong></font></td>
  100.     </tr>
  101.     <tr>
  102.       <td width="98" height="43" align="center" valign="baseline" nowrap background="images/admin_bg_1.gif" bgcolor="#FFFDE8">
  103.         <table width="100%" border="0" cellspacing="0" cellpadding="0">
  104.           <tr>
  105.             <td nowrap><strong>科&nbsp;目:</strong></td>
  106.           </tr>
  107.           <tr>
  108.             <td> <select name=Subject
  109. size="1" id=select8 onclick="changesk(document.myform.Subject.options[document.myform.Subject.selectedIndex].value)">
  110.                 <option value="all" selected>全 部</option>
  111.               </select> </td>
  112.           </tr>
  113.         </table></td>
  114.       <td width="209" align="center" valign="baseline" nowrap background="images/admin_bg_1.gif" bgcolor="#FFFDE8"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  115.           <tr>
  116.             <td nowrap><strong>知识点:</strong></td>
  117.           </tr>
  118.           <tr>
  119.             <td> <select name=KnowPoint id="select9">
  120.                 <option value="all" selected>----全 部----</option>
  121.               </select> </td>
  122.           </tr>
  123.         </table></td>
  124.       <td width="75" colspan="2" align="center" valign="baseline" nowrap background="../images/admin_bg_1.gif" bgcolor="#FFFDE8"><table width="92%" border="0" cellspacing="0" cellpadding="0">
  125.           <tr>
  126.             <td nowrap><strong>难易度:</strong></td>
  127.           </tr>
  128.           <tr>
  129.             <td> <select name=hard id="select10">
  130.                 <option value="1" selected>任意</option>
  131.                 <option value="2">容易</option>
  132.                 <option value="3">中等</option>
  133.                 <option value="4">较难</option>
  134.               </select> </td>
  135.           </tr>
  136.         </table></td>
  137.     </tr>
  138.     <tr valign="middle">
  139.       <td height="29" colspan="5" align="center" nowrap background="images/admin_bg_1.gif" bgcolor="#FFFDE8">
  140.         <strong>测试顺序:</strong>
  141.         <input type="radio" name="testorder" value="1">
  142.         随机顺序
  143.         <input type="radio" name="testorder" value="2">
  144.         从难到易
  145.         <input type="radio" name="testorder" value="3">
  146.         从易到难</td>
  147.     </tr>
  148.     <tr valign="middle">
  149.       <td height="14" colspan="5" align="center" nowrap background="images/admin_bg_1.gif" bgcolor="#FFFDE8"><font color="#000000"><strong>试题数</strong></font><strong>:</strong>
  150.         <input name="testnumber" type="text" id="testnumber2" value="5" size="10">
  151.       </td>
  152.     </tr>
  153.     <tr>
  154.       <td height="15" colspan="5" align="center" valign="baseline" nowrap background="images/admin_bg_1.gif" bgcolor="#FFFDE8"><input name="testbegin" type="submit" class="s02" id="testbegin2" onClick="window.close()" value="开 始"></td>
  155.     </tr>
  156.   </table>
  157. </FORM>
  158. <p>&nbsp;</p>
  159. </body>
  160. </html>