Exemplo n.º 1
0
  @Override
  public void service(HashMap<String, Object> params) {
    PrintStream out = (PrintStream) params.get("out");

    out.printf("%-3s %-5s %-17s %-13s %-7s\n", "No", "Name", "E-Mail", "Tel", "ClassID");

    for (Student student : studentDao.selectList()) {
      out.printf(
          "%3d %-5s %-17s %-13s %7s\n",
          student.getNo(),
          student.getName(),
          student.getEmail(),
          student.getTel(),
          student.getCid());
    }
  }
Exemplo n.º 2
0
  @RequestMapping("list")
  public String list(
      @RequestParam(defaultValue = "1") int pageNo,
      @RequestParam(defaultValue = "10") int pageSize,
      @RequestParam(defaultValue = "email") String keyword,
      @RequestParam(defaultValue = "asc") String align,
      Model model)
      throws Exception {

    HashMap<String, Object> paramMap = new HashMap<>();
    paramMap.put("startIndex", (pageNo - 1) * pageSize);
    paramMap.put("length", pageSize);
    paramMap.put("keyword", keyword);
    paramMap.put("align", align);

    List<Student> students = studentDao.selectList(paramMap);

    model.addAttribute("students", students);

    return "student/StudentList";
  }