jsp从servlet中获取的值为空
System.out.println("进入servlet"); UserServiceImpl us=new UserServiceImpl(); List<User> user_list=us.getAllUser(); request.setAttribute("userlists",user_list); response.sendRedirect("user/user_list.jsp");
servlet跳转到jsp页面时使用
response的“重定向”不能将request传递回去
System.out.println("进入servlet"); UserServiceImpl us=new UserServiceImpl(); List<User> user_list=us.getAllUser(); request.setAttribute("userlists",user_list); request.getRequestDispatcher("user/user_list.jsp").forward(request, response);
ok