jsp+ssh+mysql实现的在线考试系统源码

今天给大家演示的是一款由jsp+ssm框架(spring+springMVC+mybatis)+mysql实现的在线考试系统源码和开发教程,本系统配有完整的源码、视频开发教程、数据库文件、项目素材等详细材料。这里强调一点,本系统是在我们的万能脚手架系统的基础上开发的,如果你还没有学习脚手架系统开发教程的话请先去学习脚手架系统,如果你不学习脚手架系统的话这个系统你学不会哦!当然如果你只想要本系统的代码,并不想学习开发教程的话那你直接获取本项目资料就可以了,或者你基础能力很牛逼,那你也可以直接学习这个。本系统除了脚手架的基本功能外,实现的关于在线考试的功能有:用户前台:用户注册登录、查看考试信息、进行考试、查看考试成绩、查看历史考试记录、回顾已考试卷、修改密码、修改个人信息等,后台管理功能(脚手架功能不在这里列出),科目专业管理、考生管理、试题管理、考试管理、试卷管理、答题详情管理、考试成绩图表统计等,其中试题可以支持批量excel文件导入,试卷试题是随机生成的,每个人的试卷试题都不一样。

jsp+ssh+mysql实现的在线考试系统源码_第1张图片

jsp+ssh+mysql实现的在线考试系统源码_第2张图片

jsp+ssh+mysql实现的在线考试系统源码_第3张图片

jsp+ssh+mysql实现的在线考试系统源码_第4张图片

jsp+ssh+mysql实现的在线考试系统源码_第5张图片

 

jsp+ssh+mysql实现的在线考试系统源码_第6张图片

jsp+ssh+mysql实现的在线考试系统源码_第7张图片

jsp+ssh+mysql实现的在线考试系统源码_第8张图片

jsp+ssh+mysql实现的在线考试系统源码_第9张图片

jsp+ssh+mysql实现的在线考试系统源码_第10张图片

 代码已经上传github,下载地址: https://github.com/21503882/exam

/**
 * 学生Action类
 * @author Administrator
 *
 */
public class StudentAction extends ActionSupport implements ServletRequestAware{

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    
    private StudentDao studentDao=new StudentDao();
    private HttpServletRequest request;
    
    private String mainPage;
    
    private Student student;
    private String error;
    
    private String page;
    private int total;
    private String pageCode;
    
    private List studentList;
    
    private Student s_student;
    
    private String id;  // 学生编号
    
    private String title; // 标题
    
    public Student getStudent() {
        return student;
    }
    public void setStudent(Student student) {
        this.student = student;
    }
    public String getError() {
        return error;
    }
    public void setError(String error) {
        this.error = error;
    }


    
    public String getMainPage() {
        return mainPage;
    }
    public void setMainPage(String mainPage) {
        this.mainPage = mainPage;
    }
    
    
    
    
    public String getPageCode() {
        return pageCode;
    }
    public void setPageCode(String pageCode) {
        this.pageCode = pageCode;
    }
    public int getTotal() {
        return total;
    }
    public void setTotal(int total) {
        this.total = total;
    }
    public String getPage() {
        return page;
    }
    public void setPage(String page) {
        this.page = page;
    }
    public Student getS_student() {
        return s_student;
    }
    public void setS_student(Student s_student) {
        this.s_student = s_student;
    }
    public List getStudentList() {
        return studentList;
    }
    public void setStudentList(List studentList) {
        this.studentList = studentList;
    }
    
    
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    
    
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    /**
     * 登录验证
     * @return
     * @throws Exception
     */
    public String login()throws Exception{
        HttpSession session=request.getSession();
        Student currentUser=studentDao.login(student);
        if(currentUser==null){
            error="准考证号或者密码错误!";
            return ERROR;
        }else{
            session.setAttribute("currentUser", currentUser);
            return SUCCESS;
        }
    }
    
    /**
     * 修改密码预操作
     * @return
     * @throws Exception
     */
    public String preUpdatePassword()throws Exception{
        mainPage="student/updatePassword.jsp";
        return SUCCESS;
    }
    
    /**
     * 修改密码
     * @return
     * @throws Exception
     */
    public String updatePassword()throws Exception{
        Student s=studentDao.getStudentById(student.getId());
        s.setPassword(student.getPassword());
        studentDao.saveStudent(s);
        mainPage="student/updateSuccess.jsp";
        return SUCCESS;
    }
    
    /**
     * 查询学生信息
     * @return
     * @throws Exception
     */
    public String list()throws Exception{
        HttpSession session=request.getSession();
        if(StringUtil.isEmpty(page)){
            page="1";
        }
        if(s_student!=null){
            session.setAttribute("s_student", s_student);
        }else{
            Object o=session.getAttribute("s_student");
            if(o!=null){
                s_student=(Student)o;
            }else{
                s_student=new Student();
            }
        }
        PageBean pageBean=new PageBean(Integer.parseInt(page),Integer.parseInt(PropertiesUtil.getValue("pageSize")));
        studentList=studentDao.getStudents(s_student,pageBean);
        total=studentDao.studentCount(s_student);
        pageCode=PageUtil.genPagation(request.getContextPath()+"/student!list",total, Integer.parseInt(page), Integer.parseInt(PropertiesUtil.getValue("pageSize")));
        mainPage="student/studentList.jsp";
        return SUCCESS;
    }
    
    /**
     * 获取学生
     * @return
     * @throws Exception
     */
    public String getStudentById()throws Exception{
        student=studentDao.getStudent(id);
        mainPage="student/studentSave.jsp";
        return SUCCESS;
    }
    
    /**
     * 保存学生
     * @return
     * @throws Exception
     */
    public String saveStudent()throws Exception{
        if(StringUtil.isEmpty(student.getId())){
            student.setId("JS"+DateUtil.getCurrentDateStr());            
        }
        studentDao.saveStudent(student);
        return "save";
    }
    
    /**
     * 删除学生
     * @return
     * @throws Exception
     */
    public String deleteStudent()throws Exception{
        student=studentDao.getStudent(id);
        studentDao.studentDelete(student);
        JSONObject resultJson=new JSONObject();
        resultJson.put("success",true);
        ResponseUtil.write(resultJson,ServletActionContext.getResponse());
        return null;
    }
    
    /**
     * 预添加操作
     * @return
     * @throws Exception
     */
    public String preSave()throws Exception{
        if(StringUtil.isNotEmpty(id)){
            student=studentDao.getStudent(id);
            title="修改学生信息";
        }else{
            title="添加学生信息";
        }
        mainPage="student/studentSave.jsp";
        return SUCCESS;
    }
    
    /**
     * 注销用户
     * @throws Exception
     */
    public String logout()throws Exception{
        request.getSession().invalidate();
        return "logout";
    }
    
    public void setServletRequest(HttpServletRequest request) {
        this.request=request;
    }
    


}
 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>




管理员登录考试系统








        

        
            
                
            
            
                
                
                
                
            
            
                
                
                
                
            
            
                
                
                
                
            
            
                
            
        

                    
                    考生登录
                

        

    


你可能感兴趣的:(jsp+ssh+mysql实现的在线考试系统源码)