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

📄 shezhi_confirm.jsp

📁 JSP自动出卷系统,界面简单,功能还需要进一步扩展
💻 JSP
字号:
<%@page contentType="application/msword;charset=GBK" %> 
<%@ page language="java" import="java.sql.*" %>
<%@ page language="java" import="java.util.*" %>
<html> 
<head>	
<title>设置检验</title>
</head>
<body>
<jsp:useBean id="ss" scope="page" class="xyf.bean"/>
<%
Object DD=session.getAttribute("Tid");
if (DD==null){
out.print("对不起,你还没登陆,请先登陆<a href=denglu.jsp>首页</a>");
}

else
{	
String xs=request.getParameter("xs");
String ps=request.getParameter("ps");
String gs=request.getParameter("gs");
String js=request.getParameter("js");
String zs=request.getParameter("zs");
String xd=request.getParameter("xd");
String pd=request.getParameter("pd");
String gd=request.getParameter("gd");
String jd=request.getParameter("jd");
String zd=request.getParameter("zd");
String nandu=request.getParameter("nandu");
String course=request.getParameter("course");
String Xrray[]=new String[100];
String Prray[]=new String[100];
String Grray[]=new String[100];
String Jrray[]=new String[100];
String Zrray[]=new String[100];
ResultSet X_rs=ss.executeQuery("select * from xuanzeti where nandu='"+nandu+"' and course='"+course+"'");
int Xi=-1;
int xj=0;
int Xarray[]=new int[100];
while(X_rs.next()){
String sz=X_rs.getString("sz");
Xarray[xj]=Integer.parseInt(sz);
xj=xj+1;
if(xj>=Integer.parseInt(xs)){
Xi=1;}
}
if (Xi==-1){
out.println("<p>对不起,题库中选择题数量不够,请重新设置<a href=chujuanshezhi.jsp>返回</a>");
}
ResultSet P_rs=ss.executeQuery("select sz from panduanti where nandu='"+nandu+"' and course='"+course+"'");
int Pi=-1;
int pj=0;
int Parray[]=new int[100];
while(P_rs.next()){
String sz=P_rs.getString("sz");
Parray[pj]=Integer.parseInt(sz);
pj=pj+1;
if(pj>=Integer.parseInt(ps)){
Pi=1;}
}
if (Pi==-1){
out.println("<p>对不起,题库中判断题数量不够,请重新设置<a href=chujuanshezhi.jsp>返回</a>");
}
ResultSet G_rs=ss.executeQuery("select sz from gainianti where nandu='"+nandu+"' and course='"+course+"'");
int Gi=-1;
int gj=0;
int Garray[]=new int[100];
while(G_rs.next()){
String sz=G_rs.getString("sz");
Garray[gj]=Integer.parseInt(sz);
gj=gj+1;
if(gj>=Integer.parseInt(gs)){
Gi=1;}
}
if (Gi==-1){
out.println("<p>对不起,题库中概念题数量不够,请重新设置<a href=chujuanshezhi.jsp>返回</a>");
}
ResultSet J_rs=ss.executeQuery("select sz from jiandati where nandu='"+nandu+"' and course='"+course+"'");
int Ji=-1;
int jj=0;
int Jarray[]=new int[100];
while(J_rs.next()){
String sz=J_rs.getString("sz");
Jarray[jj]=Integer.parseInt(sz);
jj=jj+1;
if(jj>=Integer.parseInt(js)){
Ji=1;}
}
if (Ji==-1){
out.println("<p>对不起,题库中简答题数量不够,请重新设置<a href=chujuanshezhi.jsp>返回</a>");
}
ResultSet Z_rs=ss.executeQuery("select sz from zongheti where nandu='"+nandu+"' and course='"+course+"'");
int Zi=-1;
int zj=0;
int Zarray[]=new int[100];
while(Z_rs.next()){
String sz=Z_rs.getString("sz");
Zarray[zj]=Integer.parseInt(sz);
zj=zj+1;
if(zj>=Integer.parseInt(zs)){
Zi=1;}
}
if (Zi==-1){
out.println("<p>对不起,题库中综合题数量不够,请重新设置<a href=chujuanshezhi.jsp>返回</a>");
}
if ((Xi==1)&&(Pi==1)&&(Gi==1)&&(Ji==1)&&(Zi==1)){
Random random=new Random();
out.print("浙江工业大学2006-2007学年第二学期考试试卷"+"<br>");
out.print("考试科目:  "+course+"完成时间:2小时"+"<br>");
out.print("班级:________学号:__________姓名:_________"+"<br>");
out.print("一,单项选择题,每小题"+xd+"分"+"<br>");
for(int i=0;i<Integer.parseInt(xs);i++){
int j=Math.abs(random.nextInt()%Integer.parseInt(xs));
int t=Xarray[j];
ResultSet rs=ss.executeQuery("select * from xuanzeti where sz="+t);
while(rs.next()){
String id=rs.getString("id");
String A=rs.getString("A");
String B=rs.getString("B");
String C=rs.getString("C");
String D=rs.getString("D");
String answer=rs.getString("answer");
Xrray[i]=answer;
out.print(i+1+" :"+id+"(   )"+"<br>");
out.print("A:"+A+"<br>");
out.print("B:"+B+"<br>");
out.print("C:"+C+"<br>");
out.print("D:"+D+"<br>");
}
}
out.print("二,判断题,每小题"+pd+"分"+"<br>");
for(int i=0;i<Integer.parseInt(ps);i++){
int j=Math.abs(random.nextInt()%Integer.parseInt(ps));
int t=Xarray[j];
ResultSet rs=ss.executeQuery("select * from panduanti where sz="+t);
while(rs.next()){
String id=rs.getString("id");
String answer=rs.getString("answer");
Prray[i]=answer;
out.print(i+1+" :"+id+"-------------------(   )"+"<br>");
}
}
out.print("三,概念题,每小题"+gd+"分"+"<br>");
for(int i=0;i<Integer.parseInt(gs);i++){
int j=Math.abs(random.nextInt()%Integer.parseInt(gs));
int t=Garray[j];
ResultSet rs=ss.executeQuery("select * from gainianti where sz="+t);
while(rs.next()){
String id=rs.getString("id");
String answer=rs.getString("answer");
Grray[i]=answer;
out.print(i+1+" :"+id+"<br>"+"<br>"+"<br>"+"<br>");
}
}
out.print("四,简答题,每小题"+jd+"分"+"<br>");
for(int i=0;i<Integer.parseInt(js);i++){
int j=Math.abs(random.nextInt()%Integer.parseInt(js));
int t=Jarray[j];
ResultSet rs=ss.executeQuery("select * from jiandati where sz="+t);
while(rs.next()){
String id=rs.getString("id");
String answer=rs.getString("answer");
Jrray[i]=answer;
out.print(i+1+" :"+id+"<br>"+"<br>"+"<br>"+"<br>");
}
}
out.print("五,综合题,每小题"+zd+"分"+"<br>");
for(int i=0;i<Integer.parseInt(zs);i++){
int j=Math.abs(random.nextInt()%Integer.parseInt(zs));
int t=Zarray[j];
ResultSet rs=ss.executeQuery("select * from zongheti where sz="+t);
while(rs.next()){
String id=rs.getString("id");
String answer=rs.getString("answer");
Zrray[i]=answer;
out.print(i+1+" :"+id+"<br>"+"<br>"+"<br>"+"<br>");
}
}
out.print("<br>"+"<br>"+"<br>"+"参考答案:"+"<br>");
out.print("一:");
for (int i=0;i<Integer.parseInt(xs);i++){
out.print(i+1+":"+Xrray[i]+"  ");
}
out.print("<br>"+"二:");
for (int i=0;i<Integer.parseInt(ps);i++){
out.print(i+1+":"+Prray[i]+"  ");
}
out.print("<br>"+"三:");
for (int i=0;i<Integer.parseInt(gs);i++){
out.print(i+1+":"+Grray[i]+"  ");
}
out.print("<br>"+"四:");
for (int i=0;i<Integer.parseInt(js);i++){
out.print(i+1+":"+Jrray[i]+"  ");
}
out.print("<br>"+"五:");
for (int i=0;i<Integer.parseInt(zs);i++){
out.print(i+1+":"+Zrray[i]+"  ");
}
}
}
%>
</body>
</html>

⌨️ 快捷键说明

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