コード例 #1
0
ファイル: delete_jsp.java プロジェクト: kms2413/project
  public void _jspService(
      final javax.servlet.http.HttpServletRequest request,
      final javax.servlet.http.HttpServletResponse response)
      throws java.io.IOException, javax.servlet.ServletException {

    final javax.servlet.jsp.PageContext pageContext;
    javax.servlet.http.HttpSession session = null;
    final javax.servlet.ServletContext application;
    final javax.servlet.ServletConfig config;
    javax.servlet.jsp.JspWriter out = null;
    final java.lang.Object page = this;
    javax.servlet.jsp.JspWriter _jspx_out = null;
    javax.servlet.jsp.PageContext _jspx_page_context = null;

    try {
      response.setContentType("text/html; charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n");
      out.write("     \n");
      out.write(
          "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");

      request.setCharacterEncoding("euc-kr");

      out.write('\n');
      guestModel.GuestDto guest = null;
      guest =
          (guestModel.GuestDto)
              _jspx_page_context.getAttribute("guest", javax.servlet.jsp.PageContext.PAGE_SCOPE);
      if (guest == null) {
        guest = new guestModel.GuestDto();
        _jspx_page_context.setAttribute("guest", guest, javax.servlet.jsp.PageContext.PAGE_SCOPE);
      }
      out.write('\n');
      org.apache.jasper.runtime.JspRuntimeLibrary.introspect(
          _jspx_page_context.findAttribute("guest"), request);
      out.write('\n');

      int num = Integer.parseInt(request.getParameter("num"));
      out.print("num" + num);
      int check = GuestDao.getInstance().delete(guest.getNum());
      out.print("check:" + check);

      out.write("\n");
      out.write("\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
      out.write("<title>Insert title here</title>\n");
      out.write("</head>\n");
      out.write("<body>\n");
      out.write("\t");
      if (check > 0) {
        out.write("\n");
        out.write("\t\t<script type=\"text/javascript\">\n");
        out.write("\t\t\talert(\"삭제되었습니다.\");\n");
        out.write("\t\t\tlocation.href=\"write.jsp\";\n");
        out.write("\t\t</script>\n");
        out.write("\t\n");
        out.write("\t");
      } else {
        out.write("\n");
        out.write("\t\t<script type=\"text/javascript\">\n");
        out.write("\t\t\talert(\"삭제 실패.\");\n");
        out.write("\t\t\tlocation.href=\"write.jsp\";\n");
        out.write("\t\t</script>\n");
        out.write("\t");
      }
      out.write("\n");
      out.write("\t\n");
      out.write("\t\n");
      out.write("</body>\n");
      out.write("</html>");
    } catch (java.lang.Throwable t) {
      if (!(t instanceof javax.servlet.jsp.SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            if (response.isCommitted()) {
              out.flush();
            } else {
              out.clearBuffer();
            }
          } catch (java.io.IOException e) {
          }
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
コード例 #2
0
  public void _jspService(
      final javax.servlet.http.HttpServletRequest request,
      final javax.servlet.http.HttpServletResponse response)
      throws java.io.IOException, javax.servlet.ServletException {

    final java.lang.String _jspx_method = request.getMethod();
    if (!"GET".equals(_jspx_method)
        && !"POST".equals(_jspx_method)
        && !"HEAD".equals(_jspx_method)
        && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
      response.sendError(
          HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD");
      return;
    }

    final javax.servlet.jsp.PageContext pageContext;
    javax.servlet.http.HttpSession session = null;
    final javax.servlet.ServletContext application;
    final javax.servlet.ServletConfig config;
    javax.servlet.jsp.JspWriter out = null;
    final java.lang.Object page = this;
    javax.servlet.jsp.JspWriter _jspx_out = null;
    javax.servlet.jsp.PageContext _jspx_page_context = null;

    try {
      response.setContentType("text/html; charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n");
      out.write("  \n");
      out.write(" ");
      request.setCharacterEncoding("utf-8");
      out.write('\n');
      out.write(' ');
      movie.admin.filmBean gb = null;
      gb =
          (movie.admin.filmBean)
              _jspx_page_context.getAttribute("gb", javax.servlet.jsp.PageContext.PAGE_SCOPE);
      if (gb == null) {
        gb = new movie.admin.filmBean();
        _jspx_page_context.setAttribute("gb", gb, javax.servlet.jsp.PageContext.PAGE_SCOPE);
      }
      out.write('\n');
      out.write(' ');
      movie.admin.film _film = null;
      _film =
          (movie.admin.film)
              _jspx_page_context.getAttribute("_film", javax.servlet.jsp.PageContext.PAGE_SCOPE);
      if (_film == null) {
        _film = new movie.admin.film();
        _jspx_page_context.setAttribute("_film", _film, javax.servlet.jsp.PageContext.PAGE_SCOPE);
      }
      out.write('\n');
      out.write(' ');
      org.apache.jasper.runtime.JspRuntimeLibrary.introspect(
          _jspx_page_context.findAttribute("_film"), request);
      out.write("\n");
      out.write(" \n");
      out.write("\n");
      out.write(" ");

      String action = request.getParameter("action");

      if (action.equals("list")) {
        ArrayList<film> films = gb.getDBlist();
        request.setAttribute("datas", films);
        pageContext.forward("admin_mode.jsp");
      }
      if (action.equals("back")) {
        ArrayList<film> films = gb.getDBlist();
        request.setAttribute("datas", films);
        pageContext.forward("admin_mode.jsp");
      } else if (action.equals("insert")) {
        if (gb.insertDB(_film)) {
          response.sendRedirect("film_control.jsp?action=list");
        } else throw new Exception("DB 입력 오류");
      } else if (action.equals("delete")) {

        if (gb.deleteDB(_film.getId_film())) {
          response.sendRedirect("film_control.jsp?action=list");
        } else throw new Exception("DB 삭제 오류");
      }
      // else if(action.equals("update")){
      // }
      else {
      }

      out.write("\n");
      out.write("    \n");
      out.write(
          "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
      out.write("<title>Insert title here</title>\n");
      out.write("</head>\n");
      out.write("<body>\n");
      out.write("\n");
      out.write("</body>\n");
      out.write("</html>");
    } catch (java.lang.Throwable t) {
      if (!(t instanceof javax.servlet.jsp.SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            if (response.isCommitted()) {
              out.flush();
            } else {
              out.clearBuffer();
            }
          } catch (java.io.IOException e) {
          }
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }