一、源码特点
JSP 公务员考试系统 是一套完善的web设计系统,对理解JSP java编程开发语言有帮助,系统采用serlvet+dao+bean 模式开发,系统具有完整的源代码和数据库,系统主要采用B/S模式开
发。开发环境为TOMCAT7.0,Myeclipse8.5开发,数据库为Mysql,使用java语言开发
jsp公务员考试系统myeclipse开发Mysql数据库w
二、功能介绍
系统主要的角色 包括 用户和管理员
后台主要功能:
(1)用户管理:对用户信息进行添加、删除、修改和查看
(2)章节管理:对章节信息进行添加、删除、修改和查看
(3)试题管理:对试题信息进行添加、删除、修改和查看、导入
(4)试卷管理:对试卷信息进行添加、删除、修改和查看
(5)组卷管理:对组卷信息进行添加、删除、修改和查看
(6)成绩管理:对成绩信息进行查看
(7)留言管理:对出库信息进行添加、删除、修改和查看
(8)用户登录、个人信息修改
前台主要功能:
(1)系统首页查看未过期的试卷
(2)用户注册、登录
(3)试卷学习,练习,随机练习
(4)留言
(5)我的成绩
(6)章节练习情况
(7)错题库
(8)错题练习
(9)错题练习情况
(10)个人信息
成绩处理方法类
- package com.servlet;
-
- import java.io.IOException;
- import java.io.PrintWriter;
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import javax.servlet.http.HttpSession;
-
- import com.bean.chengji;
- import com.dao.chengjiDao;
-
-
- import java.util.List;
- import java.sql.ResultSet;
-
- public class chengjiServlet extends HttpServlet {
- public void service(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- request.setCharacterEncoding("gb2312");
- System.out.println("method"+request.getParameter("method"));
- String method=(String)request.getParameter("method");
- if(method.equals("insert")){//成绩添加
- insertM(request, response);
- }else if(method.equals("list")){//成绩列表
- ListM(request, response);
- }else if(method.equals("delete")){//成绩删除
- deleteM(request, response);
- }else if(method.equals("modifyindex")){//成绩修改页面
- modifyIndex(request, response);
- }
- else if(method.equals("modify")){//成绩修改
- modifyM(request, response);
- }else if(method.equals("detail")){//成绩详细信息
- detailM(request, response);
- }else if(method.equals("Plist")){//成绩列表信息
- PListM(request, response);
- }
- }
- private void insertM(HttpServletRequest request, HttpServletResponse response){//成绩添加
- chengjiDao dao=new chengjiDao();
- chengji chengji=new chengji();
- chengji.setCjid((String)request.getParameter("keyid"));
- chengji.setSj((String)request.getParameter("sj"));
- chengji.setKssj((String)request.getParameter("kssj"));
- chengji.setCj((String)request.getParameter("cj"));
- chengji.setYh((String)request.getParameter("yh"));
-
- response.setCharacterEncoding("gb2312");
- try {
- dao.insert(chengji);
- request.setAttribute("flag", "操作成功");
-
-
-
- request.getRequestDispatcher("chengji/chengjiadd.jsp").forward(request, response);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
- private void ListM(HttpServletRequest request, HttpServletResponse response){//成绩信息列表
- ResultSet rs=null;
- chengjiDao dao = new chengjiDao();
- System.out.println("alist");
-
- String sql="";
- response.setCharacterEncoding("gb2312");
- try{
- rs=dao.qlist(sql);
-
- PrintWriter out = response.getWriter();
- request.setAttribute("rs", rs);
-
-
- request.getRequestDispatcher("chengji/chengjilist.jsp").forward(request, response);
- }catch(Exception e){
- e.toString();
- e.printStackTrace();
- }
-
- }
- private void PListM(HttpServletRequest request, HttpServletResponse response){//测试信息列表
- ResultSet rs=null;
- chengjiDao dao = new chengjiDao();
-
- String str=(String)request.getParameter("Page");
- String sql="";
- response.setCharacterEncoding("gb2312");
- try{
-
- if(str==null){
- str="0";
- }
- rs=dao.qlist(sql);
-
- PrintWriter out = response.getWriter();
- request.setAttribute("rs", rs);
-
-
- request.getRequestDispatcher("chengji/chengjiPlist.jsp?Page=1").forward(request, response);
- }catch(Exception e){
- e.toString();
- e.printStackTrace();
- }
-
- }
- private void modifyIndex(HttpServletRequest request, HttpServletResponse response){//成绩修改首页
- ResultSet rs=null;
- response.setCharacterEncoding("gb2312");
- chengjiDao dao = new chengjiDao();
-
-
- String keyid=(String)request.getParameter("keyid");
- String sql="";
-
-
- if(keyid!=null&&!keyid.equals("")){
-
- sql+=" and cjid='"+keyid+"'";
-
- }
- try{
- rs=dao.qlist(sql);
- PrintWriter out = response.getWriter();
- request.setAttribute("rs", rs);
-
- request.getRequestDispatcher("chengji/chengjimodify.jsp").forward(request, response);
- //response.sendRedirect("chengji/chengjimodify.jsp");
- }catch(Exception e){
- e.toString();
- e.printStackTrace();
- }
-
- }
- private void detailM(HttpServletRequest request, HttpServletResponse response){//成绩详细信息页面
-
- ResultSet rs=null;
- response.setCharacterEncoding("gb2312");
- chengjiDao dao = new chengjiDao();
-
-
- String keyid=(String)request.getParameter("keyid");
- String sql="";
-
-
- if(keyid!=null&&!keyid.equals("")){
-
- sql+=" and cjid='"+keyid+"'";
-
- }
- try{
- rs=dao.qlist(sql);
-
- request.setAttribute("rs", rs);
- request.getRequestDispatcher("chengji/chengjidetail.jsp").forward(request, response);
- }catch(Exception e){
- e.toString();
- e.printStackTrace();
- }
-
- }
- private void deleteM(HttpServletRequest request, HttpServletResponse response){//成绩删除
- ResultSet lst=null;
- chengjiDao dao = new chengjiDao();
- response.setCharacterEncoding("gb2312");
- String keyid=(String)request.getParameter("keyid");
-
- try{
- dao.delete(keyid);
- request.setAttribute("flag", "删除成功");
- request.getRequestDispatcher("chengjiServlet?method=list").forward(request, response);
-
- //response.sendRedirect("chengjiServlet?method=list");
- }catch(Exception e){
- e.toString();
- e.printStackTrace();
- }
-
- }
-
- private void modifyM(HttpServletRequest request, HttpServletResponse response){//成绩修改功能
- chengjiDao dao=new chengjiDao();
- chengji chengji=new chengji();
- chengji.setCjid((String)request.getParameter("keyid"));
- chengji.setSj((String)request.getParameter("sj"));
- chengji.setKssj((String)request.getParameter("kssj"));
- chengji.setCj((String)request.getParameter("cj"));
- chengji.setYh((String)request.getParameter("yh"));
-
- response.setCharacterEncoding("gb2312");
- try {
- dao.modify(chengji);
- PrintWriter out = response.getWriter();
-
- request.setAttribute("flag", "操作成功");
- request.getRequestDispatcher("chengjiServlet?method=list").forward(request, response);
-
- //response.sendRedirect("chengjiServlet?method=list");
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
- }
三、注意事项
1、管理员账号:admin 密码:admin 数据库配置文件DBO.java ,权限包括管理员 和用户
2、开发环境为TOMCAT7.0,Myeclipse8.5开发,数据库为Mysql,使用java语言开发。
3、数据库文件名是jspgwyzxks 系统名称gwyzxks
4、地址:http://127.0.0.1:8080/gwyzxks/shouye.jsp
系统实现