删除功能分析、 删除功能代码实现

删除功能分析

 

 删除功能代码实现

public class DelUserServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//获取id
String id = req.getParameter("id");
//调用Service删除
UserService service = new UserServiceImpl();
service.deleteUser(id);

//跳转到查询所有Servlet
resp.sendRedirect(req.getContextPath()+"/UserListServlet");
}

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
}

 

posted @ 2022-08-19 14:51  一位程序袁  阅读(38)  评论(0编辑  收藏  举报