paperview.jsp
资源名称:examasp.rar [点击查看]
上传用户:hjt198082
上传日期:2015-04-16
资源大小:95k
文件大小:4k
源码类别:
MySQL数据库
开发平台:
Java
- <%@ page contentType="text/html;charset=GBK" %>
- <%@ page language="java" import="java.sql.*"%>
- <%@ page import="java.lang.Math.*" %>
- <%@ page import="java.util.*" %>
- <jsp:useBean id="conn" scope="page" class="test.ConnOracle"/>
- <%@ include file="/public/checkvalidadmin.jsp"%>
- <%@ include file="/public/checkvalidadmin8.jsp"%>
- <%!
- ResultSet rs = null;
- ResultSet rsTmp = null;
- String sql = "";
- int PageSize = 13;
- int Page = 1;
- int totalPage = 1;
- String str = "";
- String curr_classid = "";
- String curr_paperid = "";
- String oper_flag = "";
- %>
- <%
- curr_classid = request.getParameter("classid");
- curr_paperid = request.getParameter("paperid");
- oper_flag = request.getParameter("operflag");
- %>
- <html>
- <head>
- <title>察看试卷</title>
- <link rel="stylesheet" href="../public/style.css">
- <Script language="JavaScript">
- //打开新窗口函数openwin
- function openwin(id)
- {
- window.open('questiondetails.jsp?id='+id,'infoWin', 'height=400,width=600,scrollbars=yes,resizable=yes');
- }
- function mysubmit(flag) {
- document.myform.operflag.value=flag;
- document.myform.submit();
- }
- </Script>
- </head>
- <body class="ss">
- <center>
- <form name="myform" action="paperview.jsp" method="post">
- <%
- sql = "select * from test_classinfo";
- try {
- rs = conn.executeQuery( sql );
- }catch(Exception e) {
- out.println("访问课程信息数据出错!");
- return;
- }
- %>
- 请选择对应的班级:
- <select name=classid onchange="mysubmit(1)">
- <%
- while(rs.next()){
- String tmpclassid = rs.getString("classid");
- // 在起始状态时,设置一个curr_classid的初试值
- if(curr_classid==null || curr_classid.equals(""))
- curr_classid = tmpclassid;
- if(curr_classid!=null && curr_classid.equals(tmpclassid)) {
- out.println("<option value=" + tmpclassid + " selected>" + rs.getString("classname") + "</option>");
- }else
- out.println("<option value=" + tmpclassid + ">" + rs.getString("classname") + "</option>");
- }
- %>
- </select>
- <%
- sql = "select distinct paper_id from test_paper_info where classid='" + curr_classid + "'";
- rs = conn.executeQuery( sql );
- if(!rs.next()) {
- out.println("还没有班级代号为 " + curr_classid + " 的试题,请首先生成该班级的试题!");
- return;
- }
- %>
- 请选择要察看的试卷
- <select name="paperid" name=classid onchange="mysubmit(2)">
- <%
- String tmp_paperid = "";
- do{
- tmp_paperid = rs.getInt("paper_id") + "";
- if(oper_flag==null || oper_flag.equals("1")) {
- curr_paperid = tmp_paperid;
- oper_flag = "2"; // 避免每次循环都要重新设置curr_paperid的值
- }
- if(tmp_paperid.equals(curr_paperid)) {
- out.println("<option value=" + tmp_paperid + " selected>第" + tmp_paperid + "套</option>");
- }
- else
- out.println("<option value=" + tmp_paperid + ">第" + tmp_paperid + "套</option>");
- }while(rs.next());
- %>
- </select>
- <!--下面这个隐藏表单域主要是为了用来区别用户到底是更改了班级设定,还是更改了试卷设定进行的提交-->
- <input type="hidden" name="operflag" value="1">
- </form>
- <hr>
- <table class=dbt2 width=640 cellSpacing=1 cellPadding=3 border=0>
- <tr class=dbt3 align=middle>
- <TH>题目编号</TH>
- <TH>在试题库中编号</TH>
- <TH>题型</TH>
- <TH width=200>题目简介</TH>
- <TH>题目详细信息</TH>
- </TR>
- <%
- sql = "select * from test_paper_info where classid='" + curr_classid + "'";
- sql+= " and paper_id=" + curr_paperid;
- System.out.println(sql);
- rs = conn.executeQuery( sql );
- %>
- <%
- int k=1;
- int tmpquestionid=0;
- while(rs.next()) {
- %>
- <TR class=dbt4 align=center>
- <TD><%=k%></TD>
- <TD>
- <%
- tmpquestionid = rs.getInt("questionid");
- out.println(tmpquestionid);
- %>
- </TD>
- <TD>
- <%
- if(rs.getInt("selectid")==1) out.println("单选");
- else out.println("<font color=blue>多选</font>");
- %>
- </TD>
- <TD>
- <% int endindex = 16;
- String tmp = rs.getString("qname");
- if(tmp.length() < endindex)
- endindex = tmp.length();
- out.println(tmp.substring(0,endindex));
- %>
- </TD>
- <TD><%="<a href=javascript:openwin('"+tmpquestionid+"')>察看</a>"%></TD>
- </TR>
- <%
- k++;
- }
- %>
- <TR class=dbt4 align=center>
- <TD colspan=5><a href=paperdel.jsp?paperid=<%=curr_paperid%>&classid=<%=curr_classid%>>删除本套试卷</a></TD>
- </TR>
- </table>
- </center>
- <hr>
- </body>
- </html>