コード例 #1
0
  public int doStartTag() throws JspException {
    HttpSession session = pageContext.getSession();
    if (session.getAttribute("Database") != null) {
      dbConn = (Database) session.getAttribute("Database");
      if (session.getAttribute("User") != null) {
        selinasuser = (SelinasUser) session.getAttribute("User");

        if (session.getAttribute("ImmobilienOrderByTyp") != null)
          orderByTyp = (String) session.getAttribute("ImmobilienOrderByTyp");

        try {
          JspWriter out = pageContext.getOut();

          try {
            dbConn.getConnection();
            out.println(
                "<table cellspacing='0' cellpadding='0' width='100%' class="
                    + FB
                    + tableTagClass
                    + FB
                    + ">"
                    + writeDokumentHeaderToPageContext(columnHeader)
                    + writeDokumentDataToPageContext(
                        DataSetImmobilie.reade(dbConn, selinasuser.user, orderByTyp)));
            dbConn.close();
          } catch (Exception e) { // no DokumentLinks found
            out.println(
                "<table class="
                    + FB
                    + tableTagClass
                    + FB
                    + ">"
                    + writeDokumentHeaderToPageContext(columnHeader));
          } // catch
          return EVAL_BODY_INCLUDE; // Evaluate body into existing out stream, and start next with
                                    // doEndTag()

        } catch (Exception e) {
          throw new JspException(
              "Create of TableContent " + " Exception " + e.getMessage() + " is not vaild");
        } // try

      } else {
        throw new JspException(
            "User object in session " + session.getAttribute("User") + " has not the valid type");
      } // session.getAttribute("User")
    } else {
      throw new JspException(
          "Database object in session "
              + session.getAttribute("Database")
              + " has not the valid type");
    } // session.getAttribute("Database")
  } // doStartTag