分享
分销 收藏 举报 申诉 / 36
播放页_导航下方通栏广告

类型JSP试卷管理系统.doc

  • 上传人:人****来
  • 文档编号:3068544
  • 上传时间:2024-06-14
  • 格式:DOC
  • 页数:36
  • 大小:624.50KB
  • 下载积分:12 金币
  • 播放页_非在线预览资源立即下载上方广告
    配套讲稿:

    如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

    特殊限制:

    部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

    关 键  词:
    JSP 试卷 管理 系统
    资源描述:
    .问题描述和分工情况 1.1 问题描述 Java试卷管理系统 类型:Web应用 要求: A. 使用JSP + Servlet+ sqlserver2005实现,Web服务器用tomcat。 B. 分为以下模块: a) 题库管理 i. 分科目建立题库 ii. 题目包括填空题、单选题、多选题和问答题。每道题有知识点和难度。 b) 试卷管理 i. 根据题库中的题目生成试卷,随机抽题,但可以规定每个知识点所占的比例和抽取题目的各种难度所占的比例。 ii. 对生成的试卷可以人为修改。 iii. 以Word的格式输出试卷。 1.2 分工情况 邓思铭(组长):负责整个系统的需求分析,确定各功能模块,系统开发的分工及开发过程中的跟进,及整个系统的测试和调试工作;负责试题查询,试题修改等模块的实现。 李才运:负责应用程序写数据库连接,项目中登录,注册,抽取试题模板的实现。 蒋潇毅:负责数据库的设计,试题的收集,网页输出到word技术的实现。 2.系统总体设计 2.1开发环境描述 myeclipse8.5; tomcat 6.0.1; sql server 2005。 2.2 系统设计方案综述 本系统使用JSP + Servlet+ sqlserver2005实现,并通过tomcat5.0发布供外部测试及使用,系统的各主要功能流程如图1所示: 图1 3.系统详细设计 3.1 数据库设计 1) 绘制E-R图,如图2所示: 图2 2) 将E-R图转换为关系模型: UserInfo(Unum,Utype,Uname,Upassword); QuestionInfo(Qnum,Qcontact,Qlevel,Qtype,Qsubject,Qanswer) 3) 使用sql server 2005 创建数据库: -----------------------创建数据库----------------------- if exists(select * from sysdatabases where name='PaperManagerDB') drop database PaperManagerDB exec xp_cmdshell 'mkdir E:\accp\database\PaperManagerDB' create database PaperDB on( name='PaperManagerDB_data', filename='E:\accp\database\PaperDB\PaperManagerDB_data.mdf', size=10, filegrowth=1 ) log on ( name='PaperManagerDB_log', filename='E:\accp\database\PaperManager\PaperManagerDB_data.ldf', size=5, maxsize=20, filegrowth=1 ) go --------------------创建数据库表--------------------- /* Qnum:试题编号 Qsubject:科目 Qtype:题型 Qcontact:内容 Qpoint:知识点 Qlevel:难度 Qanswer 答案 */ use PaperManagerDB go if exists(select*from sysobjects where name='QuestionInfo') drop table QuestionInfo create table QuestionInfo ( Qnum int identity(1,1) primary key, Qsubject varchar(8) not null, Qtype varchar(10) not null, Qcontact text not null, Qpoint text not null, Qlevel varchar(10) not null, Qanswer text not null ) go 3.2 各模块设计 1) 数据库连接:通过编写DB类存储Web应用所用到常用数据库操作的方法,供Web调用; 代码:import java.sql.*; public class DBConn { Connection conn=null; Statement state=null; String sql=""; String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; //加载JDBC驱动 String dbURL = "jdbc:sqlserver://localhost:1433; DatabaseName=PaperManagerDB"; //连接服务器和数据库sample String userName = "sa"; //默认用户名 String userPwd = ""; //密码 public static Connection getConnection(){ Connection conn=null; Statement state=null; String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; String dbURL = "jdbc:sqlserver://localhost:1433; DatabaseName=PaperManagerDB"; String userName = "sa"; //默认用户名 String userPwd = ""; //密码 try { Class.forName(driverName); conn = DriverManager.getConnection(dbURL, userName, userPwd); //System.out.println("Connection Successful!"); //如果连接成功 控制台输出Connection Successful! } catch (Exception e) { e.printStackTrace(); } return conn; } public static void closeStatement(PreparedStatement pstate){ try{ if(pstate!=null){ pstate.close(); pstate=null; } }catch(SQLException e){ e.printStackTrace(); } } public static void closeConnection(Connection conn){ try{ if(conn !=null&&!conn.isClosed()){ conn.isClosed(); } }catch(SQLException e){ e.printStackTrace(); } } public static void closeResultSet(ResultSet res){ try { if (res!=null) { res.close(); res=null; } } catch (SQLException e) { e.printStackTrace(); } } } 2) 登录模块: 接受用户输入,通过javascript判断输入的合法性,若合法,则提交到登录页的jsp处理,通过查询数据库,判断是否存在此用户,或存在,刚进入主功能页面,并保存登录信息; 代码:<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script language="javascript"> function on_submit() { if(form1.username.value=="") { alert("用户名不能为空,请输入用户名!"); form1.username.focus(); return false; } if(form1.password.value=="") { alert("用户密码不能为空,请输入用户密码!"); form1.password.focus(); return false; } } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <style type="text/css"> <!-- .STYLE1 {font-size: 36px} --> </style> </head> <body> <form id="form1" name="form1" method="post" action="denglu1.jsp"> <table width="894" height="90" border="1"> <tr> <th colspan="3" bgcolor="#00CC66" scope="col"><span class="STYLE1">欢迎使用试卷管理系统</span></th> </tr> </table> <table width="890" height="329" border="1"> <tr> <th width="174" height="63" scope="col">&nbsp;</th> <th width="85" scope="col">&nbsp;</th> <th width="148" scope="col">&nbsp;</th> <th width="121" scope="col">&nbsp;</th> <th width="127" scope="col">&nbsp;</th> <th width="195" scope="col">&nbsp;</th> </tr> <tr> <td height="49">&nbsp;</td> <td><div align="right">用户名:</div></td> <td><input name="username" type="text" size="20" /></td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td height="58">&nbsp;</td> <td><div align="right">用户密码:</div></td> <td><input name="password" type="password" size="20" /></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><label></label></td> </tr> <tr> <td height="51">&nbsp;</td> <td> <div align="right">用户类型:</div></td> <td><label> <input name="type" type="radio" tabindex="管理员" value="管理员" /> 管理员</label></td> <td><label> <input type="radio" name="type" value="老师" tabindex="老师" /> 老师</label></td> <td><label> <input name="type" type="radio" tabindex="学生" value="学生" checked="checked" /> 学生</label></td> <td><a href="zhuce.jsp">注册</a></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td><label> <input name="Submit" type="submit" tabindex="登录" value="登录" /> </label></td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </table> </form> </body> </html> 3) 注册模块:接受用户输入,通过javascript判断输入的合法性,若合法,则向数据库用户表插入一条用户数据; 代码:<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <style type="text/css"> <!-- .STYLE1 { font-family: "宋体"; font-size: 36px; } .STYLE2 {font-size: 36} --> </style> </head> <script language="javascript"> function on_submit() { if(form1.username.value=="") { alert("用户名不能为空!"); form1.username.focus(); return false; } if(form1.password.value=="") { alert("密码不能为空!"); form1.password.focus(); return false; } if(form1.checkpassword.value=="") { alert("确认密码不能为空!"); form1.checkpassword.focus(); return false; } if(form1.password.value!=form1.checkpassword.value) { alert("密码不一致!"); form1.checkpassword.focus(); return false; } if(form1.licensenum.value=="") { alert("用户证件号不能为空!"); form1.licensenum.focus(); return false; } } </script> <body style=""> <div id="div1" align="center" style="height: 100px; font-family: 华文行楷; font-size: xx-large; text-decoration: blink; font-weight: bold; color: #0000FF; background-color: #CCFFCC;"> 试卷管理系统 </div> <div id="div2" style="height: 20px; background-color: #0000FF;"> </div> <div id="div3" style="width: 125px; background-color: #CCFF99; height: 600px;"> 用户信息<br /> 系统功能:<br /> <input name="Button3" type="button" id="Button" onclick="location.href='dljiemian.jsp'" value="返回" /> </div> <div id="div4" style="left: 139px; top: 139px; position: absolute; height: 550px; width: 750px;" > <form action="zchoutai.jsp" method="post" name="form1" onsubmit="return on_submit()"> <table width="748" height="408" > <tr> <th height="65" colspan="4" scope="col"><span class="STYLE1">用户注册</span></th> </tr> <tr> <td width="160">&nbsp;</td> <td width="90"> 用户名:</td> <td width="240"><label> <input type="text" name="username" /> </label></td> <td width="230">&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>用户密码:</td> <td><label> <input name="password" type="password" /> </label></td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>确认密码:</td> <td><label> <input type="password" name="checkpassword" /> </label></td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>用户证件号:</td> <td><label> <input type="text" name="licensenum" /> </label></td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>用户类型:</td> <td><span class="STYLE2"> <label> <select name="select" size="1" class="STYLE2"> <option value="学生" selected="selected">学生</option> <option value="老师">老师</option> <option value="管理员">管理员</option> </select> </label> </span></td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td><label> <input type="submit" name="Submit" value="提交" /> </label></td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </table> </form> </div> </body> </html> 4) 增加试题:接受用户输入,通过javascript判断输入的合法性,若合法,则向数据库试题表插入一条数据; 代 码:<%@ page language="java" import="java.util.*, DB.*;" contentType="text/html; charset=GBK" pageEncoding="GBK"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'addquestion.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <form name="addquestion" method="post" action="insertQuestion.jsp"> 问 题 <label> <textarea name="contact" cols="80" rows="5" id="contact"></textarea> </label> <p> <label></label> 答 案 <textarea name="answer" cols="80" rows="3" id="answer"></textarea> </p> <p>知识点 <label> <input name="point" type="text" id="point" size="80"> </label> </p> <p>科 目 <label> <select name="subject" id="subject"> <option value="语文">语文</option> <option value="数学">数学</option> <option value="英语">英语</option> </select> </label> 题目类型 <label> <select name="type" id="type"> <option value="单选题">单选题</option> <option value="多选题">单选题</option> <option value="填空题">填空题</option> <option value="简答题">简答题</option> </select> </label> 难度 <label> <select name="level" id="level"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </label> </p> <p> <label> <input type="submit" name="Submit" value="提交"> </label> <label> <input name="reset" type="reset" id="reset" value="重填 "> </label> </p> <p>&nbsp;</p> </form> <br> </body> </html> 5) 修改试题:接受用户输入,通过javascript判断输入的合法性,若合法,则向数据库更新或删除一条试题数据; 代码:<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK"%> <%@ page import=" java.util.*, DB.* ,java.sql.*" %> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <%! int qid; String num=""; String page="1"; int result=0; %> <% page=request.getParameter("page"); num=request.getParameter("id"); //qid=Integer.getInteger(num); try{ String sql="delete * from QuestionInfo where Qnum=Qnum"; sql = "delete from QuestionInfo where Qnum=" + num; Connection conn=DBConn.getConnection(); PreparedStatement pst=conn.prepareStatement(sql); int result = pst.executeUpdate(); if(result !=1 ) { out.println("<center>"); out.println("删除试题失败!<br><br>"); out.println("单击这里<a href=javascript:history.back()>返回</a><br>"); out.println("</center>"); } }catch(Exception ee) { } %> <jsp:forward page="showquestion.jsp"> <jsp:param name="Page" value="<%=page%>"/> </jsp:forward> 6) 查看试题:接受用户输入查询条件,将全部符合条件的试题输入到网页中; 代码:<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%> <%@ page import="java.sql.*" %> <%@ page import="com.tool.*" %> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'scshijuan.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <script type="text/javascript"> function on_submit() { if(form1.kemu.value.equals("0") alert("请选择科目!"); if(form1.tixing.value.equals("0") alert("请选择题型!"); if(form1.nandu.value.equals("0") alert("请选择难度!"); } </script> <body> <form id="form1" name="form1" method="post" action="zhishidian.jsp" > <table width="893" height="154" > <tr> <td width="233" height="55">&nbsp;</td> <td width="102">&nbsp;</td> <td width="179"><span class="STYLE1">试题要求</span></td> <td width="196">&nbsp;</td> <td width="149">&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td colspan="2">科目: <label><select name='kemu' size='1' id='kemu'> <option value='0' selected='selected'></option> <% String condition="select Qsubject,count(*) from QuestInfo group by qsubject"; Connection con; Statement sql; ResultSet rs; try { Class.forName(
    展开阅读全文
    提示  咨信网温馨提示:
    1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
    2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
    3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
    4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
    5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
    6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

    开通VIP折扣优惠下载文档

    自信AI创作助手
    关于本文
    本文标题:JSP试卷管理系统.doc
    链接地址:https://www.zixin.com.cn/doc/3068544.html
    页脚通栏广告

    Copyright ©2010-2026   All Rights Reserved  宁波自信网络信息技术有限公司 版权所有   |  客服电话:0574-28810668    微信客服:咨信网客服    投诉电话:18658249818   

    违法和不良信息举报邮箱:help@zixin.com.cn    文档合作和网站合作邮箱:fuwu@zixin.com.cn    意见反馈和侵权处理邮箱:1219186828@qq.com   | 证照中心

    12321jubao.png12321网络举报中心 电话:010-12321  jubao.png中国互联网举报中心 电话:12377   gongan.png浙公网安备33021202000488号  icp.png浙ICP备2021020529号-1 浙B2-20240490   


    关注我们 :微信公众号  抖音  微博  LOFTER               

    自信网络  |  ZixinNetwork