项目介绍作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
这个项目是一个基于SSM的在线考试系统,分为考试用户和管理员两种角色。
考试用户功能包括:
个人信息中心
成绩查询
在线答题
我的错题本
我的试卷
管理员功能包括:
试题管理
题型管理
用户管理
年级管理
课程管理
试卷管理
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
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项目:是;
技术栈1. 后端:Spring+SpringMVC+Mybatis
2. 前端:JSP+css+javascript+jQuery+bootstrap
使用说明1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入http://localhost:8080/online_exam_ssm/toLogin.action 登录
学生账户:zhangsan/123456
后管登录地址:http://localhost:8080/online_exam_ssm/admin/login.action
管理员账户:admin/123456
运行截图学生用户角色
管理员界面
代码相关 后台首页
@Controller
public class AdminHomeHandler {
@Autowired
ExamPaperInfoService examPaperInfoService;
@Autowired
SubjectInfoService subjectInfoService;
@Autowired
TeacherInfoService teacherInfoService;
@Autowired
StudentInfoService studentInfoService;
@Autowired
Gson gson;
private Logger logger = Logger.getLogger(AdminHomeHandler.class);
@RequestMapping("/homeInfo")
public void homeInfo(HttpServletResponse response) throws IOException {
logger.info("加载后台首页相关数据");
int examPaperTotal = examPaperInfoService.getExamPpaerTotal();
int subjectTotal = subjectInfoService.getSubjectTotal();
int teacherTotal = teacherInfoService.getTeacherTotal();
int studentTotal = studentInfoService.getStudentTotal();
String json = "{"examPaperTotal":"+examPaperTotal+", " +
""subjectTotal":"+subjectTotal+", " +
""teacherTotal":"+teacherTotal+", " +
""studentTotal":"+studentTotal+"}";
response.getWriter().print(json);
}
}
登录拦截器
ublic class LoginInterceptor extends HandlerInterceptorAdapter {
private Logger logger = Logger.getLogger(LoginInterceptor.class);
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
HttpSession session = request.getSession();
if (session.getAttribute("loginTeacher") != null) {
return true;
} else {
logger.info("检测到未登录访问后台内容操作");
//如果没有登录,跳转至登录页面
response.sendRedirect("admin/login.jsp");
return false;
}
}
}
班级管理
@Service
public class CourseInfoServiceImpl implements CourseInfoService {
@Autowired
private CourseInfoMapper courseInfoMapper;
public List getCourses(CourseInfo course) {
return courseInfoMapper.getCourses(course);
}
public int isUpdateCourse(CourseInfo course) {
return courseInfoMapper.isUpdateCourse(course);
}
public int isAddCourse(CourseInfo course) {
return courseInfoMapper.isAddCourse(course);
}
public int isDelCourse(int courseId) {
return courseInfoMapper.isDelCourse(courseId);
}
public CourseInfo getCourseById(int courseId) {
return courseInfoMapper.getCourseById(courseId);
}
}
如果也想学习本系统,下面领取。回复:229ssm



