Mercurial > hg > Members > tatsuki > JungleXMLReader
view src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/ShowBoardsServletMatrix.java @ 32:b8d86bc46b51
remove warning and rename src file
author | one |
---|---|
date | Sun, 09 Nov 2014 17:56:49 +0900 |
parents | b036c87f1e5c |
children | 037731e99d6e |
line wrap: on
line source
package jp.ac.u_ryukyu.cr.ie.tatsuki.bbs; import java.io.PrintWriter; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ShowBoardsServletMatrix extends HttpServlet { /** * */ private static final long serialVersionUID = 1L; private final XmlBulletinBoard bbs; private final String createBoardPath; private final String showBoardMessagePath; public ShowBoardsServletMatrix(XmlBulletinBoard _bbs, String _createBoardPath,String _showBoardMessagePath) { bbs = _bbs; createBoardPath = _createBoardPath; showBoardMessagePath = _showBoardMessagePath; } public void doGet(HttpServletRequest _req,HttpServletResponse _res) { try{ _res.setCharacterEncoding("UTF-8"); printBoard(_res.getWriter()); }catch(Exception _e){ _res.setStatus(500); } } private void printBoard(PrintWriter _pw) throws Exception { _pw.write("<html><body>\n"); _pw.write("<h1>BBS</h1>\n"); _pw.write("<form action='"+createBoardPath+"' method='POST'\n"); _pw.write("<p>Create new board.</p>"); _pw.write("<p>XmlPath : <input type='text' name='xmlPath'/></p>\n"); _pw.write("<p><input type='submit' value='submit'/></p><hr/>\n"); _pw.write("<h2>list of boards</h2>"); for(String board : bbs.getBoards()){ _pw.write("<p><a href='"+showBoardMessagePath+"?bname=" + bbs.sanitize(board) + "'>"+ bbs.sanitize(board) + "</a></p>"); } _pw.write("</body></html>"); _pw.flush(); } }