Exemplo n.º 1
0
 /** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */
 protected void doPost(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   response.setContentType("text/html");
   PrintWriter out = response.getWriter();
   Forum forum = new Forum();
   forum.setTitle(request.getParameter("title"));
   try {
     DBManager.insertForum(forum);
     RequestDispatcher rs = request.getRequestDispatcher("forum.jsp");
     rs.include(request, response);
   } catch (ClassNotFoundException | SQLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   out.close();
 }
Exemplo n.º 2
0
 private String executeApiQuery(String entity, String method, String content) {
   String result = null;
   switch (entity) {
     case "forum":
       result = forum.exec(method, content);
       break;
     case "post":
       result = post.exec(method, content);
       break;
     case "user":
       result = user.exec(method, content);
       break;
     case "thread":
       result = thread.exec(method, content);
       break;
     case "util":
       result = utils.exec(method, content);
       break;
   }
   if (result != null) return result;
   else return ERROR;
 }