Mercurial > hg > Members > nobuyasu > jungle-network
view src/main/java/app/bbs/thinks/EditAttributeServlet.java @ 175:066f58e93a14
remove StringEscapeUtils.unescapeHtml
author | tatsuki |
---|---|
date | Wed, 30 Jul 2014 17:57:18 +0900 |
parents | e30880a72909 |
children | ac7d1070f449 |
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 org.apache.commons.lang.StringEscapeUtils; import app.bbs.NetworkBulletinBoard; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs.BulletinBoard; public class EditAttributeServlet extends HttpServlet { private final NetworkBulletinBoard bbs; private static final String PARAM_BOARD_NAME = "bname"; private static final String PARAM_NODE_PATH = "uuid"; private static final String PARAM_BOARD_MESSAGE= "msg"; private static final String PARAM_BOARD_EDITKEY = "key"; private static final String PARAM_NODE_ID = "id"; private static final long serialVersionUID = 1L; public EditAttributeServlet(NetworkBulletinBoard _bbs) { bbs = _bbs; } public void doGet(HttpServletRequest _req,HttpServletResponse _res) { String bname = (_req.getParameter(PARAM_BOARD_NAME)); String path = (_req.getParameter(PARAM_NODE_ID)); String id = (_req.getParameter(PARAM_NODE_ID)); try{ _res.setCharacterEncoding("UTF-8"); PrintWriter pw = _res.getWriter(); pw.write("<html><body><h1>edit 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>Message<br/> <input type='textarea' name='msg'/> </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 msg = (_req.getParameter(PARAM_BOARD_MESSAGE)); String path = (_req.getParameter(PARAM_NODE_ID)); String id = (_req.getParameter(PARAM_NODE_ID)); try{ bbs.editAttribute(boardName, path,id, msg); PrintWriter pw = _res.getWriter(); pw.write("successfully written"); pw.flush(); }catch(Exception _e){ _res.setStatus(500); } } }