Пример #1
0
 public String testAjax(HttpServletRequest request, HttpServletResponse response) {
   String username = request.getParameter("username");
   System.out.println(username);
   if ("admin".equals(username)) {
     AjaxUtils.sendJSON(response, "true");
   } else {
     AjaxUtils.sendJSON(response, "false");
   }
   return "3:ajax";
 }
Пример #2
0
  public String testAjaxTable(HttpServletRequest request, HttpServletResponse response) {
    List<Student> list = new ArrayList<Student>();
    Student s1 = new Student(1, "张三", 22);
    Student s2 = new Student(2, "李四", 23);
    Student s3 = new Student(3, "王五", 24);
    Student s4 = new Student(4, "贾六", 25);
    list.add(s1);
    list.add(s2);
    list.add(s3);
    list.add(s4);
    AjaxUtils.sendJSON(response, list);

    return "3:ajax";
  }