annotate src/main/java/app/bbs/thinks/deleteNodeServlet.java @ 170:2403b9a4416f

create Delete Attribute Method
author tatsuki
date Wed, 30 Jul 2014 10:20:01 +0900
parents
children df063cf6f3b5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
170
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
1 package app.bbs.thinks;
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
2 //未実装まだひな形コピーのみ
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
3 import java.io.PrintWriter;
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
4
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
5 import javax.servlet.http.HttpServlet;
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
6 import javax.servlet.http.HttpServletRequest;
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
7 import javax.servlet.http.HttpServletResponse;
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
8
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
9 import app.bbs.NetworkBulletinBoard;
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs.BulletinBoard;
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
11
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
12 public class deleteNodeServlet extends HttpServlet
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
13 {
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
14 private final NetworkBulletinBoard bbs;
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
15 private static final String PARAM_BOARD_NAME = "bname";
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
16 private static final String PARAM_BOARD_MSGID = "uuid";
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
17 private static final String PARAM_BOARD_MESSAGE= "msg";
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
18 private static final String PARAM_BOARD_EDITKEY = "key";
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
19
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
20 private static final long serialVersionUID = 1L;
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
21
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
22 public deleteNodeServlet(NetworkBulletinBoard _bbs)
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
23 {
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
24 bbs = _bbs;
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
25 }
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
26
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
27 public void doGet(HttpServletRequest _req,HttpServletResponse _res)
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
28 {
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
29 String bname = _req.getParameter(PARAM_BOARD_NAME);
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
30 String path = _req.getParameter("path");
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
31 String id = _req.getParameter("count");
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
32
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
33
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
34 try{
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
35 PrintWriter pw = _res.getWriter();
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
36 pw.write("<html><body><h1>本当に削除しますか?message</h1>");
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
37 pw.write("<form method='POST'\n");
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
38 pw.write("<p><input type='hidden' name='path' value='"+path+"'/>" +
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
39 "<input type='hidden' name='id' value='"+id+"'/>" +
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
40 "<input type='hidden' name='bname' value='"+bname+"'</p>\n");
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
41 pw.write("<p><input type='submit' value='submit'/></p>\n");
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
42 pw.write("</body></html>");
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
43 pw.flush();
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
44 }catch(Exception _e){
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
45 _res.setStatus(500);
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
46 }
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
47 }
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
48
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
49 public void doPost(HttpServletRequest _req,HttpServletResponse _res)
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
50 {
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
51 String boardName = _req.getParameter(PARAM_BOARD_NAME);
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
52 String path = _req.getParameter("path");
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
53 String id = _req.getParameter("id");
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
54
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
55 try{
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
56 bbs.deleteAttribute(boardName, path,id);
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
57 PrintWriter pw = _res.getWriter();
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
58 pw.write("successfully written");
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
59 pw.flush();
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
60 }catch(Exception _e){
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
61 _res.setStatus(500);
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
62 }
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
63 }
2403b9a4416f create Delete Attribute Method
tatsuki
parents:
diff changeset
64 }