Example #1
0
 public void _jspInit() {
   _el_expressionfactory =
       _jspxFactory
           .getJspApplicationContext(getServletConfig().getServletContext())
           .getExpressionFactory();
   _jsp_instancemanager =
       org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
 }
Example #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("\r\n");
      out.write("    \r\n");
      out.write(
          "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n");
      out.write(
          "<link href=\"http://netdna.bootstrapcdn.com/bootstrap/2.3.2/css/bootstrap.min.css\" rel=\"stylesheet\">\r\n");
      out.write("</head>\r\n");

      String cmd = request.getParameter("cmd");
      String msg = null;

      if (request.getMethod().equals("POST")) {
        if (cmd.equals("login")) {
          int stNum = Integer.parseInt(request.getParameter("stNum"));
          String pass = request.getParameter("pass");

          Register user = new Register();

          if (user.check(stNum, pass) == 0) {
            System.out.println(user.check(stNum, pass));
            msg = "회원가입 하세요";
          } else {
            System.out.println(user.check(stNum, pass));
            if (user.check(stNum, pass) == 1) {
              session.setAttribute("id", stNum);
              response.sendRedirect("admin.jsp");
            } else {
              out.write("\r\n");
              out.write("\t\t\t\t\t<script type=\"text/javascript\">\r\n");
              out.write("\t\t\t\t\t\talert(\"로그인 실패\")\r\n");
              out.write("\t\t\t\t\t\thistory.go(-1);\r\n");
              out.write("\t\t\t\t\t</script>\r\n");
              out.write("\t\t\t\t");
            }
          }
        }
      }

      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("\t<div class=\"container\">\r\n");
      out.write("\t<h1>로그인</h1><hr/>\r\n");
      out.write("\t\t<form method=\"POST\">\r\n");
      out.write("\t\t\t<table>\r\n");
      out.write("\t\t\t\t<tr>\r\n");
      out.write(
          "                   <td><span>학번</span></td><td><input type=\"text\" name=\"stNum\"/></td>\r\n");
      out.write("               </tr>\r\n");
      out.write("\t\t\t\t<tr>\r\n");
      out.write(
          "                   <td><span>비밀번호</span></td><td><input type=\"password\" name=\"pass\"/></td>\r\n");
      out.write("               </tr>\t\r\n");
      out.write("\t\t\t</table>\r\n");
      out.write(
          "\t\t\t<button class=\"btn btn-primary\" name=\"cmd\" value=\"login\">로그인</button>\r\n");
      out.write("\t\t\t<a href=\"register.jsp\" class=\"btn\">회원가입</a>\r\n");
      out.write("\t\t</form>\r\n");
      out.write("\t</div>\t\t\r\n");
      out.write("</body>\r\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);
    }
  }
Example #3
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("\r\n");
      out.write("\r\n");
      out.write(
          "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n");
      out.write("<title>공지사항</title>\r\n");
      out.write(
          "<link href=\"http://netdna.bootstrapcdn.com/bootstrap/2.3.2/css/bootstrap.min.css\" rel=\"stylesheet\">\r\n");
      out.write("<style>\r\n");
      out.write("\t thead tr { background: #eee; }\r\n");
      out.write("\t tbody tr:hover { background-color: #DAD9FF; cursor: pointer; }\r\n");
      out.write("</style>\r\n");
      out.write("\r\n");
      out.write(
          "<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\"></script>\r\n");
      out.write("<script>\r\n");
      out.write("\t$(function(){\r\n");
      out.write("\t\t $(\"tbody tr\").click(function(){\r\n");
      out.write("\t\t\t location.href=\"adminContent.jsp?idx=\"+$(this).attr(\"data-id\");\r\n");
      out.write("\t\t });\r\n");
      out.write("\t});\r\n");
      out.write("</script>\r\n");
      out.write("</head>\r\n");

      int id;
      id = (int) session.getAttribute("id");

      System.out.println(id);
      // 해당 학번=id(세션) 값으로 정보를 불러온다.
      User user = Register.selectDetail(id);

      ArrayList<Admin> list = AdminPage.selectAll();

      String cmd = request.getParameter("cmd");
      if (request.getMethod().equals("POST")) {
        if (cmd.equals("logout")) {
          session.invalidate();

          out.write("\r\n");
          out.write("\t\t\t\t<script>\r\n");
          out.write("\t\t\t\t\talert(\"로그아웃 되었습니다\");\r\n");
          out.write("\t\t\t\t\tlocation.href=\"login.jsp\";\r\n");
          out.write("\t\t\t\t</script>\r\n");
          out.write("\t\t\t");
        }
      }

      out.write("\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("<div>\r\n");
      out.write("\t<form method=\"post\">\r\n");
      out.write(
          "\t\t<button class=\"btn btn-small\" name=\"cmd\" value=\"logout\">로그 아웃</button>\r\n");
      out.write("\t</form>\r\n");
      out.write("</div>\r\n");
      out.write("<div class=\"container\">\r\n");
      out.write("\t<h2>공지사항 게시판</h2><hr/>\r\n");
      out.write("\t<form>\r\n");
      out.write("\t\t<table class=\"table table-condensed table-bordered\">\r\n");
      out.write("\t\t\t<thead>\r\n");
      out.write("      \t\t<tr>\r\n");
      out.write("      \t\t\t<th>번호</th>\r\n");
      out.write("      \t\t\t<th>제목</th>\r\n");
      out.write("      \t\t\t<th>작성자</th>\r\n");
      out.write("      \t\t</tr>\r\n");
      out.write("      \t</thead>\r\n");
      out.write("      \t<tbody>\r\n");
      out.write("\t\t\t");
      for (Admin admin : list) {
        out.write("\r\n");
        out.write("\t\t\t<tr data-id=\"");
        out.print(admin.getIdx());
        out.write("\">\r\n");
        out.write("      \t\t\t<td>");
        out.print(admin.getIdx());
        out.write("</td>\r\n");
        out.write("      \t\t\t<td>");
        out.print(admin.getTitle());
        out.write("</td>\r\n");
        out.write("      \t\t\t<td>");
        out.print(admin.getName());
        out.write("</td>\r\n");
        out.write("    \t\t</tr>\r\n");
        out.write("    \t\t");
      }
      out.write("\r\n");
      out.write("     \t</tbody>\r\n");
      out.write("\t\t</table>\r\n");
      out.write("\t\t\r\n");
      out.write("\t\t");
      if (user.getLevel() == 2 || user.getLevel() == 3) {
        out.write("\r\n");
        out.write("\t\t<div>\r\n");
        out.write("\t\t\t<a href=\"adminWrite.jsp\" class=\"btn btn-small\">글쓰기</a>\r\n");
        out.write("\t\t</div>\r\n");
        out.write("\t\t");
      }
      out.write("\r\n");
      out.write("\t</form>\r\n");
      out.write("\t</div>\r\n");
      out.write("</body>\r\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);
    }
  }