• SSH在线考试系统


    作者主页:夜未央5788

     简介:Java领域优质创作者、Java项目、学习资料、技术互助

    文末获取源码

    项目介绍

    在线考试系统是利用Java web技术开发设计的。数据库是基于Mysql设计的。学生可以在线考试,系统实现自动阅卷,管理员可以管理学生信息,试卷信息,题目信息等;本系统分前台和后台两部分,前台实现功能有:学生登录,在线考试,成绩查询,修改密码等;后台实现功能有:管理员登录,考生信息管理,考生成绩查询,试卷管理,题目管理等;

    环境需要

    1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
    2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
    3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
    4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
    5.数据库:MySql 5.7版本;

    6.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

    技术栈

    1. 后端:spring+spring mvc+hibernate

    2. 前端:JSP+Javascript+Bootstrap

    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
    2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
    若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;
    2. 将项目中hibernate.cfg.xml配置文件中的数据库配置改为自己的配置;
    4. 运行项目,考生登录页面输入http://localhost:8080/ 登录
    考生账号密码:JS20140701094708/123456

    管理员登录页面地址:http://localhost:8080/login2.jsp

    管理员账号密码:admin/123456

    运行截图

     

     

     

     

     

     

     

     

    相关代码

    考试Action类

    1. /**
    2. * 考试Action类
    3. * @author Administrator
    4. *
    5. */
    6. public class ExamAction extends ActionSupport implements ServletRequestAware{
    7. /**
    8. *
    9. */
    10. private static final long serialVersionUID = 1L;
    11. private ExamDao examDao=new ExamDao();
    12. private QuestionDao questionDao=new QuestionDao();
    13. private HttpServletRequest request;
    14. private String mainPage;
    15. private Exam exam;
    16. private Exam s_exam;
    17. private List<Exam> examList;
    18. private String page;
    19. private int total;
    20. private String pageCode;
    21. public String getMainPage() {
    22. return mainPage;
    23. }
    24. public void setMainPage(String mainPage) {
    25. this.mainPage = mainPage;
    26. }
    27. public Exam getExam() {
    28. return exam;
    29. }
    30. public void setExam(Exam exam) {
    31. this.exam = exam;
    32. }
    33. public List<Exam> getExamList() {
    34. return examList;
    35. }
    36. public void setExamList(List<Exam> examList) {
    37. this.examList = examList;
    38. }
    39. public Exam getS_exam() {
    40. return s_exam;
    41. }
    42. public void setS_exam(Exam s_exam) {
    43. this.s_exam = s_exam;
    44. }
    45. public String getPage() {
    46. return page;
    47. }
    48. public void setPage(String page) {
    49. this.page = page;
    50. }
    51. public int getTotal() {
    52. return total;
    53. }
    54. public void setTotal(int total) {
    55. this.total = total;
    56. }
    57. public String getPageCode() {
    58. return pageCode;
    59. }
    60. public void setPageCode(String pageCode) {
    61. this.pageCode = pageCode;
    62. }
    63. /**
    64. * 计算/添加考试成绩
    65. * @return
    66. * @throws Exception
    67. */
    68. public String add()throws Exception{
    69. Map<String, String[]> keyMap = new HashMap<String, String[]>();
    70. keyMap = request.getParameterMap();
    71. Iterator<Entry<String,String[]>> it2 = keyMap.entrySet().iterator();
    72. int totalScore=0;
    73. int singleScore=0;
    74. int moreScore=0;
    75. while (it2.hasNext()) {
    76. Entry<String, String[]> entry = it2.next();
    77. String keyStr=entry.getKey();
    78. String values[]=entry.getValue();
    79. String key;
    80. String value="";
    81. if(keyStr.equals("exam.student.id")||keyStr.equals("exam.paper.id")){
    82. continue;
    83. }
    84. if(keyStr.split("-")[1].equals("r")){ // 单选
    85. key=keyStr.split("-")[2];
    86. value=values[0];
    87. singleScore+=this.calScore(key, value, "1");
    88. }else{ // 多选
    89. key=keyStr.split("-")[2];
    90. for(String s:values){
    91. value+=s+",";
    92. }
    93. value=value.substring(0,value.length()-1);
    94. moreScore+=this.calScore(key, value, "2");
    95. }
    96. }
    97. totalScore=singleScore+moreScore;
    98. exam.setSingleScore(singleScore);
    99. exam.setMoreScore(moreScore);
    100. exam.setScore(totalScore);
    101. //exam.setExamDate(new Date());
    102. examDao.saveExam(exam);
    103. mainPage="exam/examResult.jsp";
    104. return SUCCESS;
    105. }

    试卷Action类

    1. /**
    2. * 试卷Action类
    3. * @author Administrator
    4. *
    5. */
    6. public class PaperAction extends ActionSupport{
    7. /**
    8. *
    9. */
    10. private static final long serialVersionUID = 1L;
    11. private PaperDao paperDao=new PaperDao();
    12. private QuestionDao questionDao=new QuestionDao();
    13. private String mainPage;
    14. private String paperId;
    15. private List<Paper> paperList=new ArrayList<Paper>();
    16. private List<Question> squestionList=new ArrayList<Question>();
    17. private List<Question> mquestionList=new ArrayList<Question>();
    18. private String title; // 标题
    19. private Paper paper;
    20. public List<Paper> getPaperList() {
    21. return paperList;
    22. }
    23. public void setPaperList(List<Paper> paperList) {
    24. this.paperList = paperList;
    25. }
    26. public List<Question> getSquestionList() {
    27. return squestionList;
    28. }
    29. public void setSquestionList(List<Question> squestionList) {
    30. this.squestionList = squestionList;
    31. }
    32. public List<Question> getMquestionList() {
    33. return mquestionList;
    34. }
    35. public void setMquestionList(List<Question> mquestionList) {
    36. this.mquestionList = mquestionList;
    37. }
    38. public void setPaper(Paper paper) {
    39. this.paper = paper;
    40. }
    41. public Paper getPaper() {
    42. return paper;
    43. }
    44. public String getPaperId() {
    45. return paperId;
    46. }
    47. public void setPaperId(String paperId) {
    48. this.paperId = paperId;
    49. }
    50. public String getMainPage() {
    51. return mainPage;
    52. }
    53. public void setMainPage(String mainPage) {
    54. this.mainPage = mainPage;
    55. }
    56. public String getTitle() {
    57. return title;
    58. }
    59. public void setTitle(String title) {
    60. this.title = title;
    61. }
    62. /**
    63. * 获取所有试卷
    64. * @return
    65. * @throws Exception
    66. */
    67. public String list()throws Exception{
    68. paperList=paperDao.getPapers();
    69. mainPage="exam/selectPaper.jsp";
    70. return SUCCESS;
    71. }
    72. /**
    73. * 获取所有试卷(管理)
    74. * @return
    75. * @throws Exception
    76. */
    77. public String paperList()throws Exception{
    78. paperList=paperDao.getPapers();
    79. mainPage="paper/paperList.jsp";
    80. return SUCCESS;
    81. }
    82. /**
    83. * 通过id获取试卷实体
    84. * @return
    85. * @throws Exception
    86. */
    87. public String getPaperById()throws Exception{
    88. paper=paperDao.getPaper(paperId);
    89. mainPage="paper/paperSave.jsp";
    90. return SUCCESS;
    91. }
    92. /**
    93. * 保存预操作
    94. * @return
    95. * @throws Exception
    96. */
    97. public String preSave()throws Exception{
    98. if(StringUtil.isNotEmpty(paperId)){
    99. paper=paperDao.getPaper(paperId);
    100. title="修改试卷";
    101. }else{
    102. title="添加试卷";
    103. }
    104. mainPage="paper/paperSave.jsp";
    105. return SUCCESS;
    106. }
    107. /**
    108. * 保存试卷
    109. * @return
    110. * @throws Exception
    111. */
    112. public String savePaper()throws Exception{
    113. if(StringUtil.isNotEmpty(paperId)){
    114. paper.setId(Integer.parseInt(paperId));
    115. }else{
    116. paper.setJoinDate(new Date());
    117. }
    118. paperDao.savePaper(paper);
    119. return "save";
    120. }

    如果也想学习本系统,下面领取。回复:106ssh

  • 相关阅读:
    linux文本编辑YCM报错
    Android MQTT开发之 Hivemq MQTT Client
    HTML5+CSS3+JS小实例:打散文字随机浮动特效
    2609. 最长平衡子字符串
    opencv图片绘制图形-------c++
    LeetCode题目笔记——2486. 追加字符以获得子序列
    前端:nodejs版本管理神器nvm软件使用笔记
    快乐数 | LeetCode-203 | 一个简单的数学题!| Floyd判圈算法练习题 | 哈希集合 | 数学
    【深度学习】系统架构工具链的学习笔记
    回应张逸老师(一)圈子文化
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/125633855