Mercurial > hg > Database > jungle-network
view src/main/java/app/bbs/thinks/deleteNodeServlet.java @ 172:d483caeabffc
change request id
author | tatsuki |
---|---|
date | Wed, 30 Jul 2014 17:17:08 +0900 |
parents | df063cf6f3b5 |
children | e30880a72909 |
line wrap: on
line source
package app.bbs.thinks; import java.io.PrintWriter; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import app.bbs.NetworkBulletinBoard; public class deleteNodeServlet extends HttpServlet { private final NetworkBulletinBoard bbs; private static final String PARAM_BOARD_NAME = "bname"; private static final String PARAM_BOARD_PATH = "path"; private static final String PARAM_NODE_ID = "id"; private static final long serialVersionUID = 1L; public deleteNodeServlet(NetworkBulletinBoard _bbs) { bbs = _bbs; } public void doGet(HttpServletRequest _req,HttpServletResponse _res) { String bname = _req.getParameter(PARAM_BOARD_NAME); String path = _req.getParameter(PARAM_BOARD_PATH ); String id = _req.getParameter(PARAM_NODE_ID); try{ PrintWriter pw = _res.getWriter(); pw.write("<html><body><h1>delete message ?</h1>"); pw.write("<form method='POST'\n"); pw.write("<p><input type='hidden' name='path' value='" + path + "'/>" + "<input type='hidden' name='id' value='" + id +"'/>" + "<input type='hidden' name='bname' value='" + bname + "'</p>\n"); pw.write("<p><input type='submit' value='submit'/></p>\n"); pw.write("</body></html>"); pw.flush(); }catch(Exception _e){ _res.setStatus(500); } } public void doPost(HttpServletRequest _req,HttpServletResponse _res) { String boardName = _req.getParameter(PARAM_BOARD_NAME); String path = _req.getParameter(PARAM_BOARD_PATH); String id = _req.getParameter(PARAM_NODE_ID); try{ bbs.deleteNode(boardName, path, id); PrintWriter pw = _res.getWriter(); pw.write("successfully written"); pw.flush(); }catch(Exception _e){ _res.setStatus(500); } } }