影音先锋男人资源在线观看,精品国产日韩亚洲一区91,中文字幕日韩国产,2018av男人天堂,青青伊人精品,久久久久久久综合日本亚洲,国产日韩欧美一区二区三区在线

智能移動方向Jsp開發(fā)實訓任務書及實訓報告在線考試系統(tǒng)的制作

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

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

10 積分

下載資源

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

資源描述:

《智能移動方向Jsp開發(fā)實訓任務書及實訓報告在線考試系統(tǒng)的制作》由會員分享,可在線閱讀,更多相關《智能移動方向Jsp開發(fā)實訓任務書及實訓報告在線考試系統(tǒng)的制作(44頁珍藏版)》請在裝配圖網(wǎng)上搜索。

1、 學校代碼: 10128 學 號: 201320905047 JSP開發(fā)實訓報告書 題 目:在線考試系統(tǒng)的制作 學生姓名:張志勇 學 院:理學院 班 級:信計13-1 指導教師:李曉瑜、宋健、賴俊峰 二〇一六年一月 一、項目名稱   在線考試系統(tǒng)-題庫子系統(tǒng) 二、功能要求    – a、用戶管理 – b、課程管理 – c、題庫管理 三、需求分析 《在線考試系統(tǒng)-題庫子系統(tǒng)》的用戶包括用戶管理員,試題管理員和題庫使用人

2、員,旨在建立一個獨立的題庫系統(tǒng),為在線考試生成試卷提供支持,包含用戶管理,科目管理,試題管理,生成試卷,試卷分析等內(nèi)容,為用戶提供了一個快速、全面、準確的試題管理平臺。 四、設計思想 a、使用Java Web技術實現(xiàn) b、使用Mysql存儲數(shù)據(jù) c、基于MVC方式實現(xiàn)用例 設計思路:(如下圖) 分步詳解: 第一步:創(chuàng)建項目名(zhangzhiyong); 第二步:創(chuàng)建項目所需要的包; 第三步:導入需要的工具; 第四步:創(chuàng)建數(shù)據(jù)庫的連接; 第五步:需要的準備工作做好之后,明確先做用戶管理系統(tǒng)(登錄,查看,刪除,修改,增加

3、,退出;); 第六步:做好用戶管理之后進行科目管理(增加,刪除,修改,查看;); 第七步:接下來進行知識點管理(增加,刪除,修改,查看;); 五、具體實現(xiàn) 一.用戶管理: 需要的servlet: (user servlet) package cn.zhangzhiyong.service; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.a

4、nnotation.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.zhangzhiyong.util.RequestUtil; @WebServlet("/UserServlet")

5、 public class UserServlet extends HttpServlet { private static final long serialVersionUID = 1L; public UserServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEnc

6、oding("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 UserDAO();

7、User user=dao.login(userLogname, userPwd); if("login".equals(type)){ if(user!=null){ request.getSession().setAttribute("SESSION_USER",user); response.sendRedirect("res/index.html"); }else{ out.print(""); } }else if("logout".equals(type)){ request.getSession().invalidate(); out.print(""); }else if("list".

9、equals(type)){ List list=dao.selectAll(); request.setAttribute("list",list); request.getRequestDispatcher("res/user.jsp").forward(request, response); } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOExceptio

10、n { 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 javax.servlet.http.HttpServlet; import javax.servlet

11、.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 HttpServlet { private static final long s

12、erialVersionUID = 1L; public UserAddServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); String login=request.getParameter

13、("login"); String name=request.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,na

14、me,type,status); UserDAO dao=new UserDAO(); int n=dao.save(user); if(n==1){ response.sendRedirect("UserServlet?type=list"); }else{ response.sendRedirect("index.jsp"); } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletExc

15、eption, IOException { doGet(request, response); } } (UserDeleteServlet) package cn.zhangzhiyong.service; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.Http

16、ServletRequest; import javax.servlet.http.HttpServletResponse; import cn.zhangzhiyong.bean.User; import cn.zhangzhiyong.dao.UserDAO; import cn.zhangzhiyong.util.RequestUtil; import cn.zhangzhiyong.util.WebUtil; @WebServlet("/UserDeleteServlet") public class UserDeleteServlet extends HttpSer

17、vlet { private static final long serialVersionUID = 1L; public UserDeleteServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("

18、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(HttpServletRequest request, HttpServletR

19、esponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } } (UserUpdate1Servlet) package cn.zhangzhiyong.service; import java.io.File; import java.io.IOException; import javax.servlet.ServletException; import javax.servle

20、t.annotation.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.Reques

21、tUtil; import cn.zhangzhiyong.util.WebUtil; @WebServlet("/UserUpdate1Servlet") public class UserUpdate1Servlet extends HttpServlet { private static final long serialVersionUID = 1L; public UserUpdate1Servlet() { super(); } protected void doGet(HttpServletReque

22、st request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); int id=RequestUtil.getInt(request,"Id"); request.setAttribute("id", id); request.getRequestDispatcher("

23、res/user-update.jsp").forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } } (UserUpdateServlet) package cn.zhangzhiyong

24、.service; import java.io.IOException; 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; impor

25、t cn.zhangzhiyong.dao.UserDAO; import cn.zhangzhiyong.util.RequestUtil; @WebServlet("/UserUpdateServlet") public class UserUpdateServlet extends HttpServlet { private static final long serialVersionUID = 1L; public UserUpdateServlet() { super(); } protected void doGet(Ht

26、tpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); String login=request.getParameter("login"); String name=request.getParameter("name"); String passwd=request.getParameter("passwd"); int type=Intege

27、r.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){ response.sendRedirect("Us

28、erServlet?type=list"); }else{ response.sendRedirect("index.jsp"); } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } } (UserViewServlet) package cn.zhangzhiyong.service;

29、import java.io.IOException; 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.zhangzhi

30、yong.bean.User; import cn.zhangzhiyong.dao.UserDAO; import cn.zhangzhiyong.util.RequestUtil; @WebServlet("/UserViewServlet") public class UserViewServlet extends HttpServlet { private static final long serialVersionUID = 1L; public UserViewServlet() { super(); } pro

31、tected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); PrintWriter out=response.getWriter(); String type=request.getParameter("type");

32、 String userLogname=request.getParameter("userLogname"); String userPwd=request.getParameter("userPwd"); UserDAO dao=new UserDAO(); int id=RequestUtil.getInt(request,"Id"); User user1=dao.selectById(id); request.setAttribute("user",user1); request.getRequestDispatcher("res/user-sho

33、w.jsp").forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } } 需要的類: package cn.zhangzhiyong.bean; import java.sql.Timestamp; public class User { publ

34、ic 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(String login2, String name2, int type2, int status2) { super(); this.logi

35、n=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

36、 setLogin(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; } p

37、ublic int getType() { return type; } public void setType(int type) { this.type = type; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public Timestamp getLast_login() { return last_login; } public void setLas

38、t_login(Timestamp last_login) { this.last_login = last_login; } } 需要的dao: package cn.zhangzhiyong.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; i

39、mport 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.getConnection();//連接對象 PreparedStatement pstmt=null;//語句對象 //下邊是s語句 String sql="insert into userss" +

40、" values(DL_USERSS.NEXTVAL,?,?,123456,?,?,sysdate)"; try{ pstmt=conn.prepareStatement(sql); pstmt.setString(1, user.getLogin()); pstmt.setString(2, user.getName()); pstmt.setInt(3, user.getType()); pstmt.setInt(4, user.getStatus()); n=pstmt.executeUpdate();//n=更新的行數(shù) }catc

41、h(SQLException e){ e.printStackTrace(); }finally{ DBUtil.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; Strin

42、g sql="select id,login,name,passwd,type,status,last_login" + " from users where login=? and passwd=?"; try{ pstmt=conn.prepareStatement(sql); pstmt.setString(1, userLogname); pstmt.setString(2, userPwd); rs=pstmt.executeQuery(); if(rs.next()){ u=new User(); u.se

43、tId(rs.getInt(1)); u.setLogin(rs.getString(2)); u.setName(rs.getString(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(); }finally{

44、 DBUtil.closeJDBC(rs, pstmt, conn); } return u; } public User selectById(int Id) { User user=new User(); Connection conn=DBUtil.getConnection(); PreparedStatement pstmt=null; ResultSet rs=null; String sql="select * from userss where id=?"; try{ pstmt=conn.prepareStat

45、ement(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)); user.setType(rs.getInt(5)); user.setStatus(rs.getInt(6));

46、 } }catch(SQLException e){ e.printStackTrace(); }finally{ DBUtil.closeJDBC(rs, pstmt, conn); } return user; } public List selectAll(){ List list=new ArrayList(); Connection conn=DBUtil.getConnection(); PreparedStatement pstmt=null; ResultSet rs=n

47、ull; String sql="select * from userss order by id desc"; try{ pstmt=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.setPasswor

48、d(rs.getString(4)); user.setType(rs.getInt(5)); user.setStatus(rs.getInt(6)); list.add(user); } }catch(SQLException e){ e.printStackTrace(); }finally{ DBUtil.closeJDBC(rs, pstmt, conn); } return list; } //userdao中的update方法 public int update(User users){ int n

49、=-1; Connection conn=DBUtil.getConnection();//連接對象 PreparedStatement pstmt=null;//語句對象 String sql="update userss" + " set login=?,name=?,passwd=123,type=?,status=? where id=?"; try{ pstmt=conn.prepareStatement(sql); pstmt.setString(1, users.getLogin()); pstmt.setString(2,

50、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(); }finally{ DBUtil.closeJDBC(null, pstmt, conn); } return n; }

51、 //userdao中的delete 方法 public int delete(int id){ int m=-1; Connection conn=DBUtil.getConnection();//連接對象 PreparedStatement pstmt=null;//語句對象 String sql="delete from userss where id=?"; try{ pstmt=conn.prepareStatement(sql); pstmt.setInt(1,id); m=pstmt.exec

52、uteUpdate();//n=更新的行數(shù) }catch(SQLException e){ e.printStackTrace(); }finally{ DBUtil.closeJDBC(null, pstmt, conn); } return m; } } 二.科目管理: 需要的servlet: (SubjectViewServlet) package cn.zhangzhiyong.service; import java.io.IOException; import javax.servlet.ServletExcept

53、ion; import javax.servlet.annotation.WebServlet; import javax.servlet.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.Reques

54、tUtil; /** * Servlet implementation class SubjectViewServlet */ @WebServlet("/SubjectViewServlet") public class SubjectViewServlet extends HttpServlet { private static final long serialVersionUID = 1L; public SubjectViewServlet() { super(); }

55、 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); SubjectDAO dao=new SubjectDAO(); int id=RequestUtil.getInt(request,"id"

56、); Subject subject=dao.selectById(id); request.setAttribute("Subject",subject); request.getRequestDispatcher("res/subject-show.jsp").forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

57、 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.HttpServlet; import javax.servlet.http.HttpServletReque

58、st; 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 HttpServlet { private static final lo

59、ng serialVersionUID = 1L; public SubjectUpdate2Servlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Subject subject =new Subject(); subject.setKname(Reques

60、tUtil.getString(request, "kname")); subject.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.sendRedi

61、rect("ServletListServlet?type=list"); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } } (SubjectUpdate0Servlet) package cn.zhangzhiyong.service; import java.io.IOException; i

62、mport 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.Subject; import cn.zhangzhiyong.dao.SubjectDAO; i

63、mport cn.zhangzhiyong.util.RequestUtil; /** * Servlet implementation class SubjectUpdate0Servlet */ @WebServlet("/SubjectUpdate0Servlet") public class SubjectUpdate0Servlet extends HttpServlet { private static final long serialVersionUID = 1L; public SubjectUpdate0Serv

64、let() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); SubjectDAO dao=new SubjectDAO();

65、 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(HttpServletRequest request, HttpServletResponse respo

66、nse) 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等.壓縮文件請下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

相關資源

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

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

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


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