⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 english.jsp

📁 这个也是师兄的毕业设计,具体的功能我也不清楚,不过是可以用来答辩的,完整的毕业设计,有源代码,可执行文件,文档资料.
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%@ page  language="java" import="java.sql.*" import="java.util.*" import="java.lang.*"%>

<%request.setCharacterEncoding("gb2312");%>
<%
//String Subject=(String)session.getValue("Subject");
//String S_name=request.getParameter("S_name");
String S_id=(String)session.getValue("S_id");
String S_name=(String)session.getValue("S_name");
//session.putValue("S_name",S_name);
//session.putValue("Subject",Subject);

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" type="text/JavaScript" src="/myside/examin/img/youno.js"></script>
<title>答题中……</title>
<%String PID = S_id;%>
<link href="img/cssexamin.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
<!-- Begin
 var cookID = <%=PID%>;
var username = GetCookie('username'); 
   pathname = location.pathname;
    myDomain = pathname.substring(0,pathname.lastIndexOf('/')) +'/';
    var largeExpDate = new Date ();
    largeExpDate.setTime(largeExpDate.getTime() + (24 * 3600 * 1000));
 if (username == cookID) 
  {
        window.alert('警告:你曾经对网页进行了刷新,属于作弊行为,24小时内你被禁止参加考试!');
        window.location="/servlet/CTimeOut?chaoshiID=1";
		
  }
    username = cookID;

    SetCookie('username',username,largeExpDate,myDomain);

function getCookieVal (offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1)
     endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
        var arg = name + "=";
      var alen = arg.length;
        var clen = document.cookie.length;
        var i = 0;
        while (i < clen) {
               var j = i + alen;
                if (document.cookie.substring(i, j) == arg)
                        return getCookieVal (j);
                i = document.cookie.indexOf(" ", i) + 1;
                        if (i == 0)
                                break;
               }
   return null;
}

function SetCookie (name, value) {
        var argv = SetCookie.arguments;
        var argc = SetCookie.arguments.length;
        var expires = (argc > 2) ? argv[2] : null;
        var path = (argc > 3) ? argv[3] : null;
        var domain = (argc > 4) ? argv[4] : null;
        var secure = (argc > 5) ? argv[5] : false;
        document.cookie = name + "=" + escape (value) +
                ((expires == null) ? "" : ("; expires=" +
expires.toGMTString())) +
                ((path == null) ? "" : ("; path=" + path)) +
                ((domain == null) ? "" : ("; domain=" + domain)) +
                ((secure == true) ? "; secure" : "");

}
//  End -->
</script>

<script>
<!--
//按照"分:秒"的格式设置限制时间。
var limit="45:00";
if (document.images){
var parselimit=limit.split(":");
parselimit=parselimit[0]*60+parselimit[1]*1;
}
function begintimer(){
if (!document.images)
return;
if (parselimit==1)
//下面是限制时间到了后去的连接页面,自己修改。
//SetCookie('username',username);
window.location="/servlet/CTimeOut?chaoshiID=1";
else{ 
parselimit-=1;
curmin=Math.floor(parselimit/60);
cursec=parselimit;
if (curmin!=0)
curtime="您还有"+curmin+"分答题时间,合计共"+cursec+"秒!";
else
curtime="警告!您仅剩余"+cursec+"秒答题时间!";
setTimeout("begintimer()",1000);
//下一句告诉访问者剩余的时间,在文本框中显示,不想要去掉即可。
document.formDaan.Btime.value=curtime;
}
}

//-->
</script>
<style type="text/css">
<!--
.unnamed1 {
	font-size: 12px;
	font-weight: lighter;
	color: #FF0000;
	text-decoration: none;
}
-->
</style>
</head>

<body onload="begintimer()">
<jsp:useBean id="linejdbc" scope="page" class="examinline.DBConnectionBean" />

<div align="center">
  <%

int id=0;
String Question = "";
String KeyA = "";
String KeyB = "";
String KeyC = "";
String KeyD = "";
String Answer = "";
String Passage = "";
%>
  <%linejdbc.setdrivername();%>
  <img src="img/jinxing.jpg" width="153" height="36"></div>
<form action="engresult.jsp" method="post" name="formDaan" id="formDaan">
  <div align="center">
    <p><span class="banquan">ID: 
      <input name="S_id" type="text" id="s_id" value="<%=S_id%>" size="10" onFocus="this.blur()" style="color: #000000; border: 0px solid #FFFFFF; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color: #FFFFFF">
      姓名:</span> 
      <input name="S_name" type="text" class="banquan" id="s_name" style="color: #CC9900; border: 0px solid #FFFFFF; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color: #FFFFFF" onFocus="this.blur()" value="<%=S_name%>" size="10">
    </p>
    <p>
      <input name="Btime" type="text" class="table" id="Btime" style="color: #FF0000; border: 0px solid #FFFFFF; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color: #FFFFFF" onFocus="this.blur()" size="40">
    </p>
  </div>
     <table width="75%" height="50" border="0" align="center" cellpadding="0" cellspacing="1" class="table"> 
	 <!--第一部分-->
	 <tr><td bgcolor="#8CDAFF"><font size=4><div align="center">Part One Vocabulary and structure<br></div></font><font size=3><div align="left">Diretions:</div></font><div align="left">       In this part there are ten incomplete sentences,each with four suggested answer. Choose the one you think is the best answer.Mark you anser on the Answer Sheetby drawing with a pencil a short bar across thecorresponding letter in the brackets.<br></div></td></tr>
  <%
Connection conn = linejdbc.getopenConnection();
PreparedStatement p = conn.prepareStatement("select max(id) from eng_choose");
ResultSet resultp = p.executeQuery();
resultp.next();
ResultSet result=null;
int maxid=resultp.getInt(1);
resultp.close();
int num;  
int j=0;
int i=0;//随即数
int h=1;//题号

//产生50个随即数
int randnum[]=new int[11];
boolean isexsit=false;
for(num=0;num<11;num++)
{
	randnum[num]=0;
}
Random rand = new Random();
while (true)
{
isexsit=false;
i = rand.nextInt(maxid);
for(num=0;num<j;num++)
{
	if (randnum[num]==i)
	{
	isexsit=true;
	break;
	}
}
if (!isexsit)
{
	p = conn.prepareStatement("select * from eng_choose where id=?");
	p.setInt(1,i);
	result=p.executeQuery();
	if (result.next())
	{
		id=result.getInt("id");
		Question = result.getString("question");
		KeyA = result.getString("k_a");
		KeyB = result.getString("k_b");
		KeyC = result.getString("k_c");
		KeyD = result.getString("k_d");
		Answer = result.getString("answer");
		
%>

  <table width="75%" height="140" border="0" align="center" cellpadding="0" cellspacing="1" class="table">
    <tr>
      <td bgcolor="#8CDAFF"><div align="left"><%=h%>.<%=Question%>答案选择: 
          <select name="select<%=h%>" id="select<%=h%>">
            <option value="o" selected></option>
            <option value="A">A</option>
            <option value="B">B</option>
            <option value="C">C</option>
            <option value="D">D</option>
          </select>
		  <input type="hidden" name="h<%=h%>" value="<%=id%>" >
      </div></td>
    </tr>
    <tr>
      <td><div align="left">
        A.<%=KeyA%></div></td>
    </tr>
    <tr>
      <td><div align="left">
        B.<%=KeyB%></div></td>
    </tr>
    <tr>
      <td><div align="left">
        C.<%=KeyC%></div></td>
    </tr>
    <tr>
      <td><div align="left">
        D.<%=KeyD%>
        
        </div></td>
    </tr>
  </table>
  <%  System.out.println(i);     
     h++;
     randnum[j]=i;
     j++;
  }
 
//System.out.println("randnum["+j+"]="+randnum[j-1]+"<br>");

}	
if (j==4) break;
}
  result.close();
  %><!--第二部分-->
  <table width="75%" height="50" border="0" align="center" cellpadding="0" cellspacing="1" class="table">
   <tr><td bgcolor="#8CDAFF"><font size=4><div align="center">Part Two  Reading Comprehension<br></div></font><font size=3><div align="left">Diretions:</div></font><div align="left">       In this part there are four passag followed by question or unfinished statements, each with four suggested answer.Choose the one you think is the best answer.Mark you anser on the Answer Sheetby drawing with a pencil a short bar across thecorresponding letter in the brackets.<br></div></td></tr>
<%
conn = linejdbc.getopenConnection();
p = conn.prepareStatement("select max(id) from eng_read");
resultp = p.executeQuery();
resultp.next();
result=null;
ResultSet resultee=null;
 maxid=resultp.getInt(1);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -