public void doService(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException, SQLException {

    Connection conn = null;
    String JSP_PATH = "/jsp/fm/bank/";

    try {

      conn = com.cynosure.common.sql.OracleGate.getConnection();
      String page = request.getParameter("page");
      String actionCode = request.getParameter("actionCode");

      DeBug.print("page : " + page + "  actionCode :  " + actionCode);
      FinanceMaintainMgr financeMaintainMgr =
          (FinanceMaintainMgr) request.getSession().getAttribute("financeMaintainMgr");
      AttributeCode attributeCode = null;
      if (financeMaintainMgr != null) attributeCode = financeMaintainMgr.getCurrentAttributeCode();

      if (actionCode == null) {

      } else {

        if (actionCode.startsWith("view")) {
          financeMaintainMgr = new FinanceMaintainMgr();
          financeMaintainMgr.refreshAttributeCodeList(conn, page);
          request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
          financeMaintainMgr.setEntryMode("AttributeCode");
          getServletContext()
              .getRequestDispatcher(JSP_PATH + "view" + page + ".jsp")
              .forward(request, response);

        } else if (actionCode.equals("init")) {
          financeMaintainMgr = new FinanceMaintainMgr();

          /** New object type * */
          if (page.equals("Bank")) {
            financeMaintainMgr.setEntryMode("AttributeCode");
            attributeCode = new com.laconic.fm.bank.component.Bank();
          } else if (page.equals("VoucherType")) {
            financeMaintainMgr.setEntryMode("AttributeCode");
            attributeCode = new VoucherType();
          } else if (page.equals("NoteType")) {
            financeMaintainMgr.setEntryMode("AttributeCode");
            attributeCode = new NoteType();
            /*}else if (page.equals("NoteStatus")){
               financeMaintainMgr.setEntryMode("AttributeCode");
            attributeCode = new NoteStatus();*/
          } else if (page.equals("AccountType")) {
            financeMaintainMgr.setEntryMode("AttributeCode");
            attributeCode = new AccountType();
          }
          // initialize selection

          financeMaintainMgr.setCurrentAttributeCode(attributeCode);
          financeMaintainMgr.refreshAttributeCodeList(conn, page);
          request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
          getServletContext()
              .getRequestDispatcher(JSP_PATH + "add" + page + ".jsp")
              .forward(request, response);

        } else if (actionCode.equals("update")) {
          // financeMaintainMgr = new FinanceMaintainMgr();

          /** New object type * */
          if (page.equals("Bank")) {
            financeMaintainMgr.setEntryMode("UPDATE-BANK");
            String bankID = request.getParameter("bankID");
            financeMaintainMgr.setCurrentAttributeCode(financeMaintainMgr.getAttributeCode(bankID));
          } else if (page.equals("AccountType")) {
            financeMaintainMgr.setEntryMode("UPDATE-ACCOUNT-TYPE");
            String accountTypeID = request.getParameter("accountTypeID");
            financeMaintainMgr.setCurrentAttributeCode(
                financeMaintainMgr.getAttributeCode(accountTypeID));
          } else if (page.equals("NoteType")) {
            financeMaintainMgr.setEntryMode("UPDATE-NOTE-TYPE");
            String noteTypeID = request.getParameter("noteTypeID");
            financeMaintainMgr.setCurrentAttributeCode(
                financeMaintainMgr.getAttributeCode(noteTypeID));
          } else if (page.equals("VoucherType")) {
            financeMaintainMgr.setEntryMode("UPDATE-VOUCHER-TYPE");
            String voucherTypeID = request.getParameter("voucherTypeID");
            financeMaintainMgr.setCurrentAttributeCode(
                financeMaintainMgr.getAttributeCode(voucherTypeID));
          }

          // initialize selection

          // financeMaintainMgr.refreshAttributeCodeList(conn, page);
          // request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
          getServletContext()
              .getRequestDispatcher(JSP_PATH + "add" + page + ".jsp")
              .forward(request, response);

        } else {
          // set common attributes from user input //
          attributeCode.setAttributeCode(request.getParameter("attributeCode"));
          attributeCode.setAttributeName(request.getParameter("attributeName"));
          attributeCode.setDescription(request.getParameter("description"));

          // set additional attributes from user input //
          //   if (attributeCode instanceof Port) {

          //   } else if (attributeCode instanceof OBU) {
          //       OBU obu = (OBU) attributeCode;
          //       obu.setAddress(request.getParameter("address"));
          //   }

          attributeCode.validate();

          if (attributeCode.isValid()) {
            // DeBug.print("*****="+financeMaintainMgr.getEntryMode().equals("UPDATE-BANK"));
            if (financeMaintainMgr.getEntryMode().equals("UPDATE-BANK"))
              ((com.laconic.fm.bank.component.Bank) attributeCode).updateBank(conn);
            else if (financeMaintainMgr.getEntryMode().equals("UPDATE-ACCOUNT-TYPE"))
              ((AccountType) attributeCode).updateAccountType(conn);
            else if (financeMaintainMgr.getEntryMode().equals("UPDATE-NOTE-TYPE"))
              ((NoteType) attributeCode).saveNoteType();
            else if (financeMaintainMgr.getEntryMode().equals("UPDATE-VOUCHER-TYPE"))
              ((VoucherType) attributeCode).saveVoucherType();
            else attributeCode.save();

            if (attributeCode.hasMessage()) {

            } else {

              // save successfully
              // add saved attribute code to list
              ((LinkedList) financeMaintainMgr.getAttributeCodeList()).addFirst(attributeCode);

              // give a new attribute code //

              if (attributeCode instanceof com.laconic.fm.bank.component.Bank) {
                attributeCode = new com.laconic.fm.bank.component.Bank();
                financeMaintainMgr.setCurrentAttributeCode(attributeCode);
                financeMaintainMgr.refreshAttributeCodeList(conn, page);
                financeMaintainMgr.setEntryMode("AttributeCode");
                request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
              } else if (attributeCode instanceof AccountType) {
                attributeCode = new AccountType();
                financeMaintainMgr.setCurrentAttributeCode(attributeCode);
                financeMaintainMgr.refreshAttributeCodeList(conn, page);
                financeMaintainMgr.setEntryMode("AttributeCode");
                request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
              } else if (attributeCode instanceof VoucherType) {
                attributeCode = new VoucherType();
                financeMaintainMgr.setCurrentAttributeCode(attributeCode);
                financeMaintainMgr.refreshAttributeCodeList(conn, page);
                financeMaintainMgr.setEntryMode("AttributeCode");
                request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
              } else if (attributeCode instanceof NoteType) {
                attributeCode = new NoteType();
                financeMaintainMgr.setCurrentAttributeCode(attributeCode);
                financeMaintainMgr.refreshAttributeCodeList(conn, page);
                financeMaintainMgr.setEntryMode("AttributeCode");
                request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr);
              } /*else if (attributeCode instanceof NoteStatus)
                attributeCode = new NoteStatus();	*/

              financeMaintainMgr.setCurrentAttributeCode(attributeCode);
            }
          }
          getServletContext()
              .getRequestDispatcher(JSP_PATH + "add" + page + ".jsp")
              .forward(request, response);
        }
      }

    } finally {
      if (conn != null) com.cynosure.common.sql.OracleGate.freeConnection(conn);
    }
  }