Ejemplo n.º 1
0
  public void _jspService(
      javax.servlet.http.HttpServletRequest request,
      javax.servlet.http.HttpServletResponse response)
      throws java.io.IOException, javax.servlet.ServletException {
    javax.servlet.http.HttpSession session = request.getSession(true);
    com.caucho.server.webapp.WebApp _jsp_application = _caucho_getApplication();
    com.caucho.jsp.PageContextImpl pageContext =
        _jsp_pageManager.allocatePageContext(
            this, _jsp_application, request, response, null, session, 8192, true, false);

    TagState _jsp_state = null;

    try {
      _jspService(request, response, pageContext, _jsp_application, session, _jsp_state);
    } catch (java.lang.Throwable _jsp_e) {
      pageContext.handlePageException(_jsp_e);
    } finally {
      _jsp_pageManager.freePageContext(pageContext);
    }
  }
Ejemplo n.º 2
0
  private void _jspService(
      javax.servlet.http.HttpServletRequest request,
      javax.servlet.http.HttpServletResponse response,
      com.caucho.jsp.PageContextImpl pageContext,
      javax.servlet.ServletContext application,
      javax.servlet.http.HttpSession session,
      TagState _jsp_state)
      throws Throwable {
    javax.servlet.jsp.JspWriter out = pageContext.getOut();
    final javax.el.ELContext _jsp_env = pageContext.getELContext();
    javax.servlet.ServletConfig config = getServletConfig();
    javax.servlet.Servlet page = this;
    javax.servlet.jsp.tagext.JspTag _jsp_parent_tag = null;
    com.caucho.jsp.PageContextImpl _jsp_parentContext = pageContext;
    response.setContentType("text/html");
    response.setCharacterEncoding("utf-8");

    // Author: Dai Yong in June 2013
    out.write(_jsp_string0, 0, _jsp_string0.length);
    CP_Classes.Database Database;
    synchronized (pageContext.getSession()) {
      Database = (CP_Classes.Database) pageContext.getSession().getAttribute("Database");
      if (Database == null) {
        Database = new CP_Classes.Database();
        pageContext.getSession().setAttribute("Database", Database);
      }
    }
    out.write(_jsp_string1, 0, _jsp_string1.length);
    CP_Classes.Login logchk;
    synchronized (pageContext.getSession()) {
      logchk = (CP_Classes.Login) pageContext.getSession().getAttribute("logchk");
      if (logchk == null) {
        logchk = new CP_Classes.Login();
        pageContext.getSession().setAttribute("logchk", logchk);
      }
    }
    out.write(_jsp_string2, 0, _jsp_string2.length);
    Coach.LoginStatus LoginStatus;
    synchronized (pageContext.getSession()) {
      LoginStatus = (Coach.LoginStatus) pageContext.getSession().getAttribute("LoginStatus");
      if (LoginStatus == null) {
        LoginStatus = new Coach.LoginStatus();
        pageContext.getSession().setAttribute("LoginStatus", LoginStatus);
      }
    }
    out.write(_jsp_string1, 0, _jsp_string1.length);
    Coach.Coach Coach;
    synchronized (pageContext.getSession()) {
      Coach = (Coach.Coach) pageContext.getSession().getAttribute("Coach");
      if (Coach == null) {
        Coach = new Coach.Coach();
        pageContext.getSession().setAttribute("Coach", Coach);
      }
    }
    out.write(_jsp_string3, 0, _jsp_string3.length);

    String username = (String) session.getAttribute("username");

    if (!logchk.isUsable(username)) {

      out.write(_jsp_string4, 0, _jsp_string4.length);
    } else {

      if (request.getParameter("add") != null) {
        if (request.getParameter("Name") != null) {
          String name = request.getParameter("Name");
          String link = "";
          if (request.getParameter("Link") != "") {
            link = request.getParameter("Link");
          }

          // check whether SlotGroup name already exists in database
          Boolean Exist = false;

          Vector v = Coach.getAllCoach();
          for (int i = 0; i < v.size(); i++) {
            voCoach vo = (voCoach) v.elementAt(i);

            String coachName = vo.getCoachName();
            // System.out.println("Existing Schedule Name:"+slotGroupName);
            if (name.trim().equalsIgnoreCase((coachName.trim()))) {
              Exist = true;
              System.out.println("Same Coach Name");
            }
          }

          if (!Exist) {
            try {
              boolean add = Coach.addCoach(name, link);

              if (add) {

                out.write(_jsp_string5, 0, _jsp_string5.length);

              } else {

              }
            } catch (Exception SE) {
              System.out.println(SE);
            }
          } else {

            out.write(_jsp_string6, 0, _jsp_string6.length);
          }
        }
      }

      out.write(_jsp_string7, 0, _jsp_string7.length);
    }
    out.write(_jsp_string8, 0, _jsp_string8.length);
  }