Пример #1
0
  public void GetGrades(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    GetGradesForm form = new GetGradesForm();
    HttpSession session = request.getSession();
    String keyword = request.getParameter("keywords");
    session.setAttribute("keyword", keyword);
    System.out.println(keyword);

    if (keyword.equals("0")) {
      form.setStu_num(request.getParameter("content"));
      session.setAttribute("getgrade_stu_num", form.getStu_num());
      System.out.println(form.getStu_num());
    } else if (keyword.equals("1")) {
      form.setStu_name(request.getParameter("content"));
      session.setAttribute("getgrade_stu_name", form.getStu_name());
    } else if (keyword.equals("2")) {
      form.setEntr_time(request.getParameter("content"));
      session.setAttribute("getgrade_entr_time", form.getEntr_time());
    } else if (keyword.equals("3")) {
      form.setCourse_id(request.getParameter("content"));
      session.setAttribute("getgrade_course_id", form.getCourse_id());
      System.out.println(form.getCourse_id());
    }
    form.setCollege(request.getParameter("college"));

    System.out.println(
        form.getStu_num()
            + " "
            + form.getStu_name()
            + " "
            + form.getEntr_time()
            + " "
            + form.getCollege());
    session.setAttribute("getgrade_college", form.getCollege());

    response.sendRedirect("result.jsp");
  }
Пример #2
0
  public void GetModifyGrades(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    GetGradesForm form = new GetGradesForm();
    form.setStu_num(request.getParameter("stu_num"));
    form.setCollege(request.getParameter("college"));
    form.setCourse_id(request.getParameter("course_id"));

    System.out.println(
        form.getStu_num()
            + " "
            + form.getStu_name()
            + " "
            + form.getEntr_time()
            + " "
            + form.getCollege());
    HttpSession session = request.getSession();
    session.setAttribute("getgrade_stu_num", form.getStu_num());
    session.setAttribute("getgrade_college", form.getCollege());
    session.setAttribute("getgrade_course_id", form.getCourse_id());
    if (form.getStu_num() != "" && form.getCourse_id() != "" && form.getCollege() != "")
      response.sendRedirect("domodify.jsp");
    else response.sendRedirect("modify.jsp");
  }