request.setAttribute("message", "操作失败!"); request.getRequestDispatcher("admin/ds/index.jsp").forward(request, response); } } elseif(method.equals("delds2")){ //add 删除 String id = request.getParameter("id"); String sql="delete from ds where id='"+id+"'"; int flag = cBean.comUp(sql); if(flag == Constant.SUCCESS){ request.setAttribute("message", "操作成功!"); request.getRequestDispatcher("admin/ds/index.jsp").forward(request, response); } else { request.setAttribute("message", "操作失败!"); request.getRequestDispatcher("admin/ds/index.jsp").forward(request, response); } } elseif(method.equals("cx")){ //add 删除 String lx = request.getParameter("lx"); String word = request.getParameter("word"); request.setAttribute("word", word); request.setAttribute("lx", lx); request.getRequestDispatcher("member/cx/"+lx+".jsp").forward(request, response); } }
/** * Initialization of the servlet. <br> * * @throws ServletException if an error occure */ publicvoidinit()throws ServletException { // Put your code here }
* Destruction of the servlet. <br> */ publicvoiddestroy(){ super.destroy(); // Just puts "destroy" string in log // Put your code here }
/** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ publicvoiddoGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response); }
/** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ publicvoiddoPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
* * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ publicvoiddoPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {