欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    智能移动方向Jsp开发实训任务书及实训报告线考试系统制作.docx

    • 资源ID:63187185       资源大小:22.44KB        全文页数:55页
    • 资源格式: DOCX        下载积分:9.9金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要9.9金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    智能移动方向Jsp开发实训任务书及实训报告线考试系统制作.docx

    智能移动方向Jsp开发实训任务书及实训报告线考试系统制作向 智能移动方向 Jsp 开发实训任务书及实训报告在线考试系统的制作 JSP 开发实训报告书题 题 目 :在 线 考 试 系 统 的 制 作 学 生 姓 名 勇 :张 志 勇 学 学 院 院 院 :理 学 院 班 班 计 级 :信 计 13-1 指 导 教 师 :李 晓 瑜 、 宋 健 、 赖 俊 峰 二一六年一月一、 项目名称 在线考试系统-题库子系统 二、 功能要求– a、用户治理 –b、课程治理 –c、题库治理 三、 需求分析 在线考试系统-题库子系统的用户包括用户治理员,试题治理员和题库运用人员,旨在建立一个独立的题库系统,为在线考试生成试卷供应支持,包含用户治理,科目治理,试题治理,生成试卷,试卷分析等内容,为用户供应了一个快速、全面、精确的试题治理平台。四、 设计思想a、运用 Java Web 技术实现b、运用 Mysql 储备数据c、基于 MVC 方式实现用例 设计思路:(如下图)分步详解:第一步:创建项目名(zhangzhiyong); 其次步:创建项目所须要的包; 第三步:导入须要的工具; 第四步:创建数据库的连接; 第五步:须要的预备工作做好之后,明确先做用户治理系统(登录,查看,删除,修改,增加,退出;); 第六步:做好用户治理之后进行科目治理(增加,删除,修改,查看;); 第七步:接下来进行学问点治理(增加,删除,修改,查看;);五、 详细实现 一用户治理:须要的 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.annotation.WebServlet; import javax.servlet.Servlet; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import cn.zhangzhiyong.bean.User; import cn.zhangzhiyong.dao.UserDAO; import cn.zhangzhiyong.util.RequestUtil; WebServlet(/UserServlet) public class UserServlet extends Servlet private static final long serialVersionUID = 1L; public UserServlet() super(); protected void doGet(ServletRequest request, ServletResponse response) 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); UserDAO 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);else out.print(lt;script type="text/javascript"gt;);out.print(alert("用户名或密码错误,请重新输入!");); out.print(window.location="login.jsp"); out.print(lt;/scriptgt;); else if(logout.equals(type)request.getSession().invalidate();out.print(lt;script type="text/javascript"gt;);out.print(window.location="login.jsp");out.print(lt;/scriptgt;); else if(list.equals(type)Listlt;Usergt; list=dao.selectAll();request.setAttribute(list,list);request.getRequestDispatcher(res/user.jsp).forward(request, response); protected void doPost(ServletRequest request, ServletResponse 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 javax.servlet.Servlet; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import cn.zhangzhiyong.bean.User; import cn.zhangzhiyong.dao.UserDAO; import cn.zhangzhiyong.util.RequestUtil; WebServlet(/UserAddServlet) public class UserAddServlet extends Servlet private static final long serialVersionUID = 1L;public UserAddServlet() super(); protected void doGet(ServletRequest request, ServletResponse response) throws ServletException, IOException request.setCharacterEncoding(utf-8);String login=request.getParameter(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,name,type,status); UserDAO dao=new UserDAO(); int n=dao.save(user); if(n=1)response.sendRedirect(UserServlet?type=list); elseresponse.sendRedirect(index.jsp); protected void doPost(ServletRequest request, ServletResponse response) throws ServletException, IOException doGet(request, response); ( UserDeleteServl et )package cn.zhangzhiyong.service; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.Servlet; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; 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 Servlet private static final long serialVersionUID = 1L; public UserDeleteServlet() super(); protected void doGet(ServletRequest request, ServletResponse response) 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(ServletRequest request, ServletResponse 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.servlet.annotation.WebServlet; import javax.servlet.Servlet; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.Part; import cn.zhangzhiyong.bean.User; import cn.zhangzhiyong.dao.UserDAO; import cn.zhangzhiyong.util.RequestUtil; import cn.zhangzhiyong.util.WebUtil; WebServlet(/UserUpdate1Servlet) public class UserUpdate1Servlet extends Servlet private static final long serialVersionUID = 1L;public UserUpdate1Servlet() super(); protected void doGet(ServletRequest request, ServletResponse 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(res/user-update.jsp).forward(request, response); protected void doPost(ServletRequest request, ServletResponse response) throws ServletException, IOException / TODO Auto-generated method stub doGet(request, response); ( UserUpdateServlet )package cn.zhangzhiyong.service; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.Servlet; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import cn.zhangzhiyong.bean.User; import cn.zhangzhiyong.dao.UserDAO; import cn.zhangzhiyong.util.RequestUtil; WebServlet(/UserUpdateServlet) public class UserUpdateServlet extends Servlet private static final long serialVersionUID = 1L; public UserUpdateServlet() super(); protected void doGet(ServletRequest request, ServletResponse 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=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)response.sendRedirect(UserServlet?type=list); elseresponse.sendRedirect(index.jsp); protected void doPost(ServletRequest request, ServletResponse response) throws ServletException, IOException doGet(request, response); ( UserViewServlet )package cn.zhangzhiyong.service;import java.io.IOException; import java.io.PrintWriter;import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.Servlet; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse;import cn.zhangzhiyong.bean.User; import cn.zhangzhiyong.dao.UserDAO; import cn.zhangzhiyong.util.RequestUtil; WebServlet(/UserViewServlet)public class UserViewServlet extends Servlet private static final long serialVersionUID = 1L; public UserViewServlet() super(); protected void doGet(ServletRequest request, ServletResponse response) 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); UserDAO dao=new UserDAO(); 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(ServletRequest request, ServletResponse response) throws ServletException, IOException doGet(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(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 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;public 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 setLast_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; 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.getConnection();/连接对象 PreparedStatement pstmt=null;/语句对象 /下边是 s 语句 String sql=insert into userss + 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=更新的行数 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=select 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.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(); finallyDBUtil.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.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); user.setType(rs.getInt(5); user.setStatus(rs.getInt(6); catch(SQLException e)e.printStackTrace(); finallyDBUtil.closeJDBC(rs, pstmt, conn); return user;public Listlt;Usergt; selectAll() Listlt;Usergt; list=new ArrayListlt;Usergt;(); Connection conn=DBUtil.getConnection(); PreparedStatement pstmt=null; ResultSet rs=null; 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.setPassword(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=-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, users.getName();pstmt.setInt(3, users.getType(); pstmt.setInt(4, users.getStatus(); pstmt.setInt(5,users.getId();n=pstmt.executeUpdate();/n=更新的行数 catch(SQLException e)e.printStackTrace(); finallyDBUtil.closeJDBC(null, pstmt, conn); return n;/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.executeUpdate();/n=更新的行数 catch(SQLException e)e.printStackTrace(); finallyDBUtil.closeJDBC(null, pstmt, conn); return m; 二科目治理:须要的 servlet:( SubjectViewServlet )package cn.zhangzhiyong.service;impor

    注意事项

    本文(智能移动方向Jsp开发实训任务书及实训报告线考试系统制作.docx)为本站会员(w****)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开