修改功能代码实现用户修改
修改功能代码实现用户修改
public class UserListServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//1.调用UserService完成查询
UserServiceImpl service = new UserServiceImpl();
List<User> users = service.findAll();
//2.将list存入request域
req.setAttribute("users",users);
//3.转发到list.jsp
req.getRequestDispatcher("/list.jsp").forward(req,resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
}