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

教育系统应用

开发平台:

WORD

  1. <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
  2. <%!
  3. String sqlCon;
  4. String sql;
  5. String selectID;
  6. boolean debug=false;
  7. String[] arrID;
  8. String[] arrSelect;
  9. %>
  10. <%
  11. String errorpad_grade=request.getParameter("Grade");
  12. String errorpad_sub=request.getParameter("Subject");
  13. String errorpad_knowpoint=request.getParameter("KnowPoint");
  14. String errorpad_testtype=request.getParameter("testtype");
  15. String errorpad_errorcount=request.getParameter("errorcount");
  16. if(debug){
  17.     out.print("<br>grade="+errorpad_grade+
  18.     "<br>sub="+errorpad_sub+
  19.     "<br>knowpoint="+errorpad_knowpoint+
  20.     "<br>testtype="+errorpad_testtype+
  21.     "<br>errorcunt="+errorpad_errorcount);
  22. }
  23. if(errorpad_grade!=null)
  24. {
  25.     session.setAttribute("errorpad_grade",errorpad_grade);
  26. }
  27. else
  28. {
  29.     errorpad_grade=(String)session.getAttribute("errorpad_grade");
  30. }
  31. if(errorpad_sub!=null)
  32. {
  33.     session.setAttribute("errorpad_sub",errorpad_sub);
  34. }else
  35. {
  36.     errorpad_sub=(String)session.getAttribute("errorpad_sub");
  37. }
  38. if(errorpad_knowpoint!=null)
  39. {
  40.     session.setAttribute("errorpad_knowpoint",errorpad_knowpoint);
  41. }
  42. else
  43. {
  44.     errorpad_knowpoint=(String)session.getAttribute("errorpad_knowpoint");
  45. }
  46. if(errorpad_testtype!=null)
  47. {
  48.     session.setAttribute("errorpad_testtype",errorpad_testtype);
  49. }
  50. else
  51. {
  52.     errorpad_testtype=(String)session.getAttribute("errorpad_testtype");
  53. }
  54. if(errorpad_errorcount!=null)
  55. {
  56.     session.setAttribute("errorpad_errorcount",errorpad_errorcount);
  57. }
  58. else
  59. {
  60.     errorpad_errorcount=(String)session.getAttribute("errorpad_errorcount");
  61. }
  62. int idnum=0;
  63. try{
  64. arrID=(String[])session.getAttribute("arrID");
  65. arrSelect=(String[])session.getAttribute("arrSelect");
  66. //处理旧页面
  67. String order_chk=request.getParameter("order_chk");
  68. if(debug){
  69. out.print("<br>order_chk="+order_chk);
  70. out.print("<br>arrID="+arrID.toString());
  71. out.print("<br>arrSelect="+arrSelect.toString());
  72. }
  73. if(order_chk!=null && !order_chk.equals("temp")){
  74. //145:0#146:1#
  75. String arrOrder_Sin[]=null;
  76. String arrOrder_chk[]=order_chk.split("#");
  77. for(int i=0;i<arrOrder_chk.length;i++){
  78. if(debug)
  79. out.print("<br> arrorder_chk["+i+"]="+arrOrder_chk[i]);
  80. arrOrder_Sin=arrOrder_chk[i].split(":");
  81. arrSelect[Integer.parseInt(arrOrder_Sin[0])-1]=arrOrder_Sin[1];
  82. }
  83. }
  84. //取回选择试题的ID
  85. selectID="";
  86. StringBuffer sb=new StringBuffer();
  87. idnum=0;
  88. for(int i=0;i<arrID.length;i++){
  89. if(arrSelect[i].equals("1")){
  90. sb.append(arrID[i]+",");
  91. idnum++;
  92. }
  93. }
  94. selectID=sb.toString().substring(0,sb.length()-1);
  95. if(debug)
  96. out.print("<br>selectID="+selectID);
  97. session.setAttribute("errorpad_selectID",selectID);
  98. }
  99. catch(Exception e){
  100.     out.print("<br>error "+e.toString());
  101. }
  102. %>
  103. <script language="javascript">
  104. function CheckForm(f)
  105. {
  106. if( f.testnumber.value.length<1)
  107. {
  108.     alert("您还有输入测验的试题数!");
  109. return false;
  110. }
  111. if(!isNumberString(f.testnumber.value,"1234567890."))
  112. {
  113.     alert("嘿!您在试题数里填了东西,但怎么不是数字呢?n");
  114.     return false;
  115. }else if(f.testnumber.value<5 && (!f.testtype[1].checked)){
  116.             alert("您在试题数里填写大于4的数字!");
  117.             return false;
  118. }
  119.    if( !(f.testtype[0].checked || f.testtype[1].checked||f.testtype[2].checked) ) {
  120. alert("您还没有选择打印范围!!")
  121. return false;
  122. }
  123.     if(f.testtype[1].checked){
  124.         if(f.selectcount.value==0){
  125.             alert("您还没有在错题本中选择错题!!");
  126.             return false;
  127.         }
  128.     }
  129. if( !(f.testorder[0].checked || f.testorder[1].checked||f.testorder[2].checked) ) {
  130. alert("您还没有选择测试顺序!")
  131. return false;
  132. }
  133. if(!(f.printtest.checked||f.printanswer.checked||f.printtip.checked)){
  134. alert("您还没有选择打印内容!")
  135. return false;
  136. }
  137. return true;
  138. }
  139. function isNumberString (InString,RefString)
  140. {
  141. if(InString.length==0) return (false);
  142. for (Count=0; Count < InString.length; Count++)  {
  143. TempChar= InString.substring (Count, Count+1);
  144. if (RefString.indexOf (TempChar, 0)==-1)
  145. return (false);
  146. }
  147. return (true);
  148. }
  149. </script>
  150. <html>
  151. <head>
  152. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  153. <title>错题本测验-选择测验类型</title>
  154. </head>
  155. <body bgcolor="#C8D6F0">
  156. <div align="center">
  157.   <form action="err_test_print.jsp" method="post" name="testtype" target="_blank" onSubmit="return CheckForm(this)">
  158.     <table width="561" border="0" align="center" cellpadding="0" cellspacing="0">
  159.       <tr>
  160.         <td height="42" colspan="4"> <div align="center"><font color="#000000">精化学堂错题本</font>-请选择打印内容</div></td>
  161.       </tr>
  162.       <tr>
  163.         <td height="30" colspan="2" nowrap><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 打印范围:</font></td>
  164.         <td nowrap><font color="#000000">打印顺序:</font></td>
  165.         <td nowrap>打印内容:</td>
  166.       </tr>
  167.       <tr>
  168.         <td width="9%"><div align="right">
  169.             <input type="radio" name="testtype" value="1">
  170.           </div></td>
  171.         <td width="35%" nowrap>浏览的错题</td>
  172.         <td width="26%" nowrap>
  173. <input type="radio" name="testorder" value="1">
  174.           随机顺序</td>
  175.         <td width="30%" nowrap>
  176. <input name="printtest" type="checkbox" id="printtest" value="1" checked onClick="this.checked=true">
  177.           试题</td>
  178.       </tr>
  179.       <tr>
  180.         <td> <div align="right">
  181.             <input type="radio" name="testtype" value="2"  onclick="document.testtype.testnumber.value=document.testtype.selectcount.value">
  182.           </div></td>
  183.         <td nowrap>浏览列表中选中的错题</td>
  184.         <td nowrap>
  185. <input type="radio" name="testorder" value="2">
  186.           从难到易</td>
  187.         <td nowrap><input name="printanswer" type="checkbox" id="printanswer" value="1">
  188.           答案 </td>
  189.       </tr>
  190.       <tr>
  191.         <td height="23"> <div align="right">
  192.             <input type="radio" name="testtype" value="3">
  193.           </div></td>
  194.         <td nowrap>错题本中的所有错题</td>
  195.         <td nowrap>
  196. <input type="radio" name="testorder" value="3">
  197.           从易到难</td>
  198.         <td nowrap><input name="printtip" type="checkbox" id="printtip" value="1">
  199.           <font color="#000000">提示</font></td>
  200.       </tr>
  201.       <tr>
  202.         <td height="43" colspan="4" nowrap><div align="center"><font color="#000000">试题数:
  203.             <input name="testnumber" type="text" id="testnumber2" value="5" size="10">
  204.             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  205.             </font></div></td>
  206.       </tr>
  207.       <tr>
  208.         <td colspan="4" nowrap> <div align="center">
  209.             <input name="testbegin" type="submit" id="testbegin3" value="打 印" onClick="window.close()">
  210.           </div></td>
  211.       </tr>
  212.     </table>
  213.     <p align="left">&nbsp; </p>
  214.     <p>&nbsp; </p>
  215.     <p>
  216.       <input  name="sqlcon" id="sqlcon3" type="hidden" value="<%=sqlCon%>" >
  217.       <input  name="selectcount" id="sql3" type="hidden" value="<%=idnum%>" >
  218.     </p>
  219.     <p>&nbsp;</p>
  220.     <p>&nbsp;</p>
  221.   </form>
  222.   <p align="left">&nbsp;</p>
  223.   <p align="left"><font color="#000000"> </font></p>
  224.   <p align="left">&nbsp; </p>
  225. </div>
  226. </body>
  227. </html>