zoukankan      html  css  js  c++  java
  • 每周总结

    对servlet的用途以及关联页面和dao层有了更清楚的认识,servlet层对于大项目的提高效率有很显著的效果

    private void select(HttpServletRequest req, HttpServletResponse resp) throws IOException, Exception {

    req.setCharacterEncoding("utf-8");
    List<studentid> list = new ArrayList();
    List<teacherid> list2 = new ArrayList();
    int id = Integer.parseInt(req.getParameter("id"));
    String password = req.getParameter("password");
    studentid sid = new studentid();
    HttpSession session = req.getSession();
    list = dao.select();
    list2 = dao2.select();
    for (int i = 0; i < list.size(); i++) {
    if (list.get(i).getId() == id) {
    if (list.get(i).getPassword().equals(password)) {
    session.setAttribute("id", id);
    session.setAttribute("password", password);
    Dao_Student daos = new Dao_Student();
    student stu = daos.Select(id);
    session.setAttribute("stu", stu);
    req.getRequestDispatcher("student.jsp").forward(req, resp);
    return;
    }
    }
    }
    for (int i = 0; i < list2.size(); i++) {
    if (list2.get(i).getId() == id) {
    if (list2.get(i).getPassword().equals(password)) {
    session.setAttribute("id", id);
    session.setAttribute("password", password);
    Dao_Teacher daot = new Dao_Teacher();
    teacher tea = daot.Select(id);
    session.setAttribute("tea", tea);
    req.getRequestDispatcher("teacher.jsp").forward(req, resp);
    return;
    }
    }
    }
    if (id == 00000000 && password.equals("root")) {
    req.getRequestDispatcher("manager.jsp").forward(req, resp);
    return;

    }
    req.setAttribute("message", "账号不存在或密码错误,请重新输入");
    req.getRequestDispatcher("menu.jsp").forward(req, resp);
    return;
    }

  • 相关阅读:
    scrapy.FormRequest与FormRequest.from_response 的区别
    可迭代对象和生成器
    css选择器
    xlwt写入excel时候的合并单元格
    html form提交的几种方式
    Python decorator 拦截器
    python manage.py makemigrations & migrate
    asianux4.5 环境, 本地yum源,局域网yum源的配置
    mysql基本操作
    sqlite-mysql migrate
  • 原文地址:https://www.cnblogs.com/buxiang-Christina/p/14158965.html
Copyright © 2011-2022 走看看