智能移動(dòng)方向Jsp開發(fā)實(shí)訓(xùn)任務(wù)書及實(shí)訓(xùn)報(bào)告在線考試系統(tǒng)的制作

上傳人:仙*** 文檔編號(hào):35090840 上傳時(shí)間:2021-10-25 格式:DOC 頁數(shù):44 大?。?41.50KB
收藏 版權(quán)申訴 舉報(bào) 下載
智能移動(dòng)方向Jsp開發(fā)實(shí)訓(xùn)任務(wù)書及實(shí)訓(xùn)報(bào)告在線考試系統(tǒng)的制作_第1頁
第1頁 / 共44頁
智能移動(dòng)方向Jsp開發(fā)實(shí)訓(xùn)任務(wù)書及實(shí)訓(xùn)報(bào)告在線考試系統(tǒng)的制作_第2頁
第2頁 / 共44頁
智能移動(dòng)方向Jsp開發(fā)實(shí)訓(xùn)任務(wù)書及實(shí)訓(xùn)報(bào)告在線考試系統(tǒng)的制作_第3頁
第3頁 / 共44頁

下載文檔到電腦,查找使用更方便

10 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《智能移動(dòng)方向Jsp開發(fā)實(shí)訓(xùn)任務(wù)書及實(shí)訓(xùn)報(bào)告在線考試系統(tǒng)的制作》由會(huì)員分享,可在線閱讀,更多相關(guān)《智能移動(dòng)方向Jsp開發(fā)實(shí)訓(xùn)任務(wù)書及實(shí)訓(xùn)報(bào)告在線考試系統(tǒng)的制作(44頁珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。

1、 學(xué)校代碼: 10128 學(xué) 號(hào): 201320905047 JSP開發(fā)實(shí)訓(xùn)報(bào)告書題 目:在線考試系統(tǒng)的制作學(xué)生姓名:張志勇學(xué) 院:理學(xué)院班 級(jí):信計(jì)13-1指導(dǎo)教師:李曉瑜、宋健、賴俊峰 二一六年一月一、項(xiàng)目名稱在線考試系統(tǒng)-題庫子系統(tǒng)二、功能要求 a、用戶管理 b、課程管理 c、題庫管理 三、需求分析 在線考試系統(tǒng)-題庫子系統(tǒng)的用戶包括用戶管理員,試題管理員和題庫使用人員,旨在建立一個(gè)獨(dú)立的題庫系統(tǒng),為在線考試生成試卷提供支持,包含用戶管理,科目管理,試題管理,生成試卷,試卷分析等內(nèi)容,為用戶提供了一個(gè)快速、全面、準(zhǔn)確的試題管理平臺(tái)。四、設(shè)計(jì)思想 a、使用Java Web技術(shù)實(shí)現(xiàn) b、使用

2、Mysql存儲(chǔ)數(shù)據(jù) c、基于MVC方式實(shí)現(xiàn)用例設(shè)計(jì)思路:(如下圖)分步詳解:第一步:創(chuàng)建項(xiàng)目名(zhangzhiyong);第二步:創(chuàng)建項(xiàng)目所需要的包;第三步:導(dǎo)入需要的工具;第四步:創(chuàng)建數(shù)據(jù)庫的連接;第五步:需要的準(zhǔn)備工作做好之后,明確先做用戶管理系統(tǒng)(登錄,查看,刪除,修改,增加,退出;);第六步:做好用戶管理之后進(jìn)行科目管理(增加,刪除,修改,查看;);第七步:接下來進(jìn)行知識(shí)點(diǎn)管理(增加,刪除,修改,查看;);五、具體實(shí)現(xiàn)一用戶管理:需要的servlet:(user servlet)package cn.zhangzhiyong.service;import java.io.IOExce

3、ption;import java.io.PrintWriter;import java.util.List;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import cn.zhangzhiyong.bean.User;im

4、port cn.zhangzhiyong.dao.UserDAO;import cn.zhangzhiyong.util.RequestUtil;WebServlet(/UserServlet)public class UserServlet extends HttpServlet private static final long serialVersionUID = 1L; public UserServlet() super(); protected void doGet(HttpServletRequest request, HttpServletResponse response)

5、throws ServletException, IOException request.setCharacterEncoding(utf-8);response.setContentType(text/html;charset=utf-8);PrintWriter out=response.getWriter();String type=request.getParameter(type);String userLogname=request.getParameter(userLogname);String userPwd=request.getParameter(userPwd);User

6、DAO dao=new UserDAO();User user=dao.login(userLogname, userPwd);if(login.equals(type)if(user!=null)request.getSession().setAttribute(SESSION_USER,user);response.sendRedirect(res/index.html);elseout.print();out.print(alert(用戶名或密碼錯(cuò)誤,請(qǐng)重新輸入!););out.print(window.location=login.jsp;);out.print();else if(l

7、ogout.equals(type)request.getSession().invalidate();out.print();out.print(window.location=login.jsp;);out.print();else if(list.equals(type)List list=dao.selectAll();request.setAttribute(list,list);request.getRequestDispatcher(res/user.jsp).forward(request, response);protected void doPost(HttpServlet

8、Request request, HttpServletResponse response) throws ServletException, IOException doGet(request, response);(user add servlet)package cn.zhangzhiyong.service;import java.io.IOException;import java.io.PrintWriter;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import

9、 javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import cn.zhangzhiyong.bean.User;import cn.zhangzhiyong.dao.UserDAO;import cn.zhangzhiyong.util.RequestUtil;WebServlet(/UserAddServlet)public class UserAddServlet extends HttpSe

10、rvlet private static final long serialVersionUID = 1L; public UserAddServlet() super(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException request.setCharacterEncoding(utf-8);String login=request.getParameter(login);String name=request

11、.getParameter(name);int type=(request.getParameter(type)=null)?3:Integer.parseInt(request.getParameter(type);int status=(request.getParameter(status)=null)?1:Integer.parseInt(request.getParameter(status);User user=new User(login,name,type,status);UserDAO dao=new UserDAO();int n=dao.save(user);if(n=1

12、)response.sendRedirect(UserServlet?type=list);elseresponse.sendRedirect(index.jsp);protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException doGet(request, response);(UserDeleteServlet)package cn.zhangzhiyong.service;import java.io.IOExcepti

13、on;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import cn.zhangzhiyong.bean.User;import cn.zhangzhiyong.dao.UserDAO;import cn.zhangzhiy

14、ong.util.RequestUtil;import cn.zhangzhiyong.util.WebUtil;WebServlet(/UserDeleteServlet)public class UserDeleteServlet extends HttpServlet private static final long serialVersionUID = 1L; public UserDeleteServlet() super(); protected void doGet(HttpServletRequest request, HttpServletResponse response

15、) throws ServletException, IOException request.setCharacterEncoding(UTF-8);/ System.out.println(request.getParameter(Id); int id=RequestUtil.getInt(request,Id); UserDAO dao=new UserDAO(); dao.delete(id); WebUtil.forward(request, response, UserServlet?type=list); protected void doPost(HttpServletRequ

16、est request, HttpServletResponse response) throws ServletException, IOException / TODO Auto-generated method stubdoGet(request, response);(UserUpdate1Servlet)package cn.zhangzhiyong.service;import java.io.File;import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.anno

17、tation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.Part;import cn.zhangzhiyong.bean.User;import cn.zhangzhiyong.dao.UserDAO;import cn.zhangzhiyong.util.RequestUtil;import cn.zhan

18、gzhiyong.util.WebUtil;WebServlet(/UserUpdate1Servlet)public class UserUpdate1Servlet extends HttpServlet private static final long serialVersionUID = 1L; public UserUpdate1Servlet() super(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOExc

19、eption request.setCharacterEncoding(utf-8);response.setContentType(text/html;charset=utf-8);int id=RequestUtil.getInt(request,Id); request.setAttribute(id, id); request.getRequestDispatcher(res/user-update.jsp).forward(request, response); protected void doPost(HttpServletRequest request, HttpServlet

20、Response response) throws ServletException, IOException / TODO Auto-generated method stubdoGet(request, response);(UserUpdateServlet)package cn.zhangzhiyong.service;import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.H

21、ttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import cn.zhangzhiyong.bean.User;import cn.zhangzhiyong.dao.UserDAO;import cn.zhangzhiyong.util.RequestUtil;WebServlet(/UserUpdateServlet)public class UserUpdateServlet extends HttpServlet private s

22、tatic final long serialVersionUID = 1L; public UserUpdateServlet() super(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException request.setCharacterEncoding(utf-8);String login=request.getParameter(login);String name=request.getParamete

23、r(name);String passwd=request.getParameter(passwd);int type=Integer.parseInt(request.getParameter(type);int status=Integer.parseInt(request.getParameter(status);int id=RequestUtil.getInt(request,id);User users=new User(login,name,type,status);UserDAO dao=new UserDAO();int n=dao.update(users);if(n=1)

24、response.sendRedirect(UserServlet?type=list);elseresponse.sendRedirect(index.jsp);protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException doGet(request, response);(UserViewServlet)package cn.zhangzhiyong.service;import java.io.IOException;

25、import java.io.PrintWriter;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import cn.zhangzhiyong.bean.User;import cn.zhangzhiyong.dao.Use

26、rDAO;import cn.zhangzhiyong.util.RequestUtil;WebServlet(/UserViewServlet)public class UserViewServlet extends HttpServlet private static final long serialVersionUID = 1L; public UserViewServlet() super(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletEx

27、ception, IOException request.setCharacterEncoding(utf-8);response.setContentType(text/html;charset=utf-8);PrintWriter out=response.getWriter();String type=request.getParameter(type);String userLogname=request.getParameter(userLogname);String userPwd=request.getParameter(userPwd);UserDAO dao=new User

28、DAO();int id=RequestUtil.getInt(request,Id);User user1=dao.selectById(id);request.setAttribute(user,user1);request.getRequestDispatcher(res/user-show.jsp).forward(request, response);protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException d

29、oGet(request, response);需要的類:package cn.zhangzhiyong.bean;import java.sql.Timestamp;public class User public static final String passwd=123456;private int id;private String login;private String name;private String password;private int type;private int status;private Timestamp last_login; public User

30、(String login2, String name2, int type2, int status2) super();this.login=login2;this.name=name2;this.type=type2;this.status=status2;public User() public User(int id2) this.id=id2;public int getId() return id;public void setId(int id) this.id = id;public String getLogin() return login;public void set

31、Login(String login) this.login = login;public String getName() return name;public void setName(String name) this.name = name;public String getPassword() return password;public void setPassword(String password) this.password = password;public int getType() return type;public void setType(int type) th

32、is.type = type;public int getStatus() return status;public void setStatus(int status) this.status = status;public Timestamp getLast_login() return last_login;public void setLast_login(Timestamp last_login) this.last_login = last_login;需要的dao:package cn.zhangzhiyong.dao;import java.sql.Connection;imp

33、ort java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException;import java.util.ArrayList;import java.util.List;import cn.zhangzhiyong.bean.User;import cn.zhangzhiyong.util.DBUtil;public class UserDAO /userdao中的save方法public int save(User user)int n=-1;Connection conn=DBUtil.ge

34、tConnection();/連接對(duì)象PreparedStatement pstmt=null;/語句對(duì)象/下邊是s語句String sql=insert into userss+ values(DL_USERSS.NEXTVAL,?,?,123456,?,?,sysdate);trypstmt=conn.prepareStatement(sql);pstmt.setString(1, user.getLogin();pstmt.setString(2, user.getName();pstmt.setInt(3, user.getType();pstmt.setInt(4, user.get

35、Status();n=pstmt.executeUpdate();/n=更新的行數(shù)catch(SQLException e)e.printStackTrace();finallyDBUtil.closeJDBC(null, pstmt, conn);return n;public User login(String userLogname, String userPwd) Connection conn=DBUtil.getConnection();PreparedStatement pstmt=null;ResultSet rs=null;User u=null;String sql=sel

36、ect id,login,name,passwd,type,status,last_login+ from users where login=? and passwd=?;trypstmt=conn.prepareStatement(sql);pstmt.setString(1, userLogname);pstmt.setString(2, userPwd);rs=pstmt.executeQuery();if(rs.next()u=new User();u.setId(rs.getInt(1);u.setLogin(rs.getString(2);u.setName(rs.getStri

37、ng(3);u.setPassword(rs.getString(4);u.setType(rs.getInt(5);u.setStatus(rs.getInt(6);u.setLast_login(rs.getTimestamp(7);catch(SQLException e)e.printStackTrace();finallyDBUtil.closeJDBC(rs, pstmt, conn);return u;public User selectById(int Id) User user=new User();Connection conn=DBUtil.getConnection()

38、;PreparedStatement pstmt=null;ResultSet rs=null;String sql=select * from userss where id=?;trypstmt=conn.prepareStatement(sql);pstmt.setInt(1, Id);rs=pstmt.executeQuery();if(rs.next()user.setId(rs.getInt(1);user.setLogin(rs.getString(2);user.setName(rs.getString(3);user.setPassword(rs.getString(4);u

39、ser.setType(rs.getInt(5);user.setStatus(rs.getInt(6);catch(SQLException e)e.printStackTrace();finallyDBUtil.closeJDBC(rs, pstmt, conn);return user;public List selectAll()List list=new ArrayList();Connection conn=DBUtil.getConnection();PreparedStatement pstmt=null;ResultSet rs=null;String sql=select

40、* from userss order by id desc;trypstmt=conn.prepareStatement(sql);rs=pstmt.executeQuery();while(rs.next()User user=new User();user.setId(rs.getInt(1);user.setLogin(rs.getString(2);user.setName(rs.getString(3);user.setPassword(rs.getString(4);user.setType(rs.getInt(5);user.setStatus(rs.getInt(6);lis

41、t.add(user);catch(SQLException e)e.printStackTrace();finallyDBUtil.closeJDBC(rs, pstmt, conn);return list;/userdao中的update方法public int update(User users)int n=-1;Connection conn=DBUtil.getConnection();/連接對(duì)象PreparedStatement pstmt=null;/語句對(duì)象String sql=update userss + set login=?,name=?,passwd=123,typ

42、e=?,status=? where id=?;trypstmt=conn.prepareStatement(sql);pstmt.setString(1, users.getLogin();pstmt.setString(2, users.getName();pstmt.setInt(3, users.getType();pstmt.setInt(4, users.getStatus();pstmt.setInt(5,users.getId();n=pstmt.executeUpdate();/n=更新的行數(shù)catch(SQLException e)e.printStackTrace();f

43、inallyDBUtil.closeJDBC(null, pstmt, conn);return n;/userdao中的delete 方法public int delete(int id)int m=-1;Connection conn=DBUtil.getConnection();/連接對(duì)象PreparedStatement pstmt=null;/語句對(duì)象String sql=delete from userss where id=?;trypstmt=conn.prepareStatement(sql);pstmt.setInt(1,id);m=pstmt.executeUpdate(

44、);/n=更新的行數(shù)catch(SQLException e)e.printStackTrace();finallyDBUtil.closeJDBC(null, pstmt, conn);return m;二科目管理:需要的servlet:(SubjectViewServlet)package cn.zhangzhiyong.service;import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet

45、.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import cn.zhangzhiyong.bean.Subject;import cn.zhangzhiyong.dao.SubjectDAO;import cn.zhangzhiyong.util.RequestUtil;/* * Servlet implementation class SubjectViewServlet */WebServlet(/SubjectVie

46、wServlet)public class SubjectViewServlet extends HttpServlet private static final long serialVersionUID = 1L; public SubjectViewServlet() super(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException request.setCharacterEncoding(utf-8);r

47、esponse.setContentType(text/html;charset=utf-8);SubjectDAO dao=new SubjectDAO();int id=RequestUtil.getInt(request,id);Subject subject=dao.selectById(id);request.setAttribute(Subject,subject);request.getRequestDispatcher(res/subject-show.jsp).forward(request, response);protected void doPost(HttpServl

48、etRequest request, HttpServletResponse response) throws ServletException, IOException doGet(request, response);(SubjectUpdate2Servlet)package cn.zhangzhiyong.service;import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.

49、HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import cn.zhangzhiyong.bean.Subject;import cn.zhangzhiyong.dao.SubjectDAO;import cn.zhangzhiyong.util.RequestUtil;WebServlet(/SubjectUpdate2Servlet)public class SubjectUpdate2Servlet extends HttpSe

50、rvlet private static final long serialVersionUID = 1L; public SubjectUpdate2Servlet() super(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException Subject subject =new Subject();subject.setKname(RequestUtil.getString(request, kname);sub

51、ject.setType(RequestUtil.getInt(request, type);subject.setKint(RequestUtil.getString(request, kint);subject.setId(RequestUtil.getInt(request, id);SubjectDAO dao=new SubjectDAO();int n=dao.update(subject);response.sendRedirect(ServletListServlet?type=list);protected void doPost(HttpServletRequest req

52、uest, HttpServletResponse response) throws ServletException, IOException doGet(request, response);(SubjectUpdate0Servlet)package cn.zhangzhiyong.service;import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;i

53、mport javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import cn.zhangzhiyong.bean.Subject;import cn.zhangzhiyong.dao.SubjectDAO;import cn.zhangzhiyong.util.RequestUtil;/* * Servlet implementation class SubjectUpdate0Servlet */WebServlet(/SubjectUpdate0Servlet)publ

54、ic class SubjectUpdate0Servlet extends HttpServlet private static final long serialVersionUID = 1L; public SubjectUpdate0Servlet() super(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException request.setCharacterEncoding(utf-8);response

55、.setContentType(text/html;charset=utf-8);SubjectDAO dao=new SubjectDAO();int id=RequestUtil.getInt(request,id);Subject subject=dao.selectById(id);request.setAttribute(Subject,subject);request.getRequestDispatcher(res/subject-update.jsp).forward(request, response);protected void doPost(HttpServletReq

56、uest request, HttpServletResponse response) throws ServletException, IOException doGet(request, response);(SubjectListServlet)package cn.zhangzhiyong.service;import java.io.IOException;import java.util.List;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import cn.zhangzhiyong.dao.SubjectDAO;import cn.zhangzhiyong.bea

展開閱讀全文
溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

相關(guān)資源

更多
正為您匹配相似的精品文檔
關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號(hào):ICP2024067431號(hào)-1 川公網(wǎng)安備51140202000466號(hào)


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺(tái),本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng),我們立即給予刪除!