项目中的删除功能

来源:互联网 发布:mac文件共享 xp 编辑:程序博客网 时间:2024/09/21 09:29

删除套路:

在删除按钮处添加

href="${pageContext.request.contextPath}/CategoryServlet?method=delete?category.cid=${category.cid } "

 

在控制器中写:

获取cid  调用删除方法  转发数据

public void delete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

String cid=request.getParameter("cid");

cs.delete(cid);

request.getRequestDispatcher("CategoryServlet?method=selectAll").for ward(request, response);

}

原创粉丝点击