protected int countSubMenus(MenuVO menuVO) {
   int i = 0;
   if (menuVO != null) {
     i = 1;
     if (menuVO.getSubMenuVec() != null && menuVO.getSubMenuVec().size() > 0) {
       for (MenuVO vo : menuVO.getSubMenuVec()) {
         i += countSubMenus(vo);
       }
     }
   }
   return i;
 }
  public String onNavigator(HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    if (hasLogin(request)) {
      Map<String, MenuVO> menuMap = filtUserMenu(request, response);
      Vector<MenuVO> vecFirst = null, vecSecond = null, vecMain = null;
      MenuVO rootMenuVO = menuMap.get(ILoginConstant.LOGIN_AJAX_ROOTPK);
      vecFirst = rootMenuVO.getSubMenuVec();
      MenuVO focusFirst = null;
      MenuVO focusSecond = null;
      String strFocusMenu = (String) request.getParameter(ILoginConstant.ATTR_SELECTED_MENU);
      if (strFocusMenu != null && menuMap.get(strFocusMenu) != null) {
        MenuVO tempFocus = menuMap.get(strFocusMenu);
        if (ILoginConstant.LOGIN_AJAX_ROOTPK.equals(tempFocus.getMenuParentCode())) {
          focusFirst = tempFocus;
        } else {
          // select Second Menu
          focusFirst = menuMap.get(tempFocus.getMenuParentCode());
          focusSecond = tempFocus;
          vecSecond = focusFirst.getSubMenuVec();
        }
      }

      if (focusFirst == null && vecFirst != null) {
        focusFirst = vecFirst.get(0);
        vecSecond = focusFirst.getSubMenuVec();
      }

      if (focusSecond == null && vecSecond != null) {
        focusSecond = vecSecond.get(0);
      }

      if (focusSecond != null) {
        vecMain = focusSecond.getSubMenuVec();
      }

      resetFocus(vecFirst, vecSecond, focusFirst, focusSecond);

      request.setAttribute(ILoginConstant.ATTR_SELECTED_MENU_FIRST, vecFirst);
      request.setAttribute(ILoginConstant.ATTR_SELECTED_MENU_SECOND, vecSecond);
      request.setAttribute(ILoginConstant.ATTR_SELECTED_MENU_MAIN, vecMain);

      return "navigator.jsp";
    }
    return "login.jsp";
  }
  private void resetFocus(
      Vector<MenuVO> vecFirst, Vector<MenuVO> vecSecond, MenuVO focusFirst, MenuVO focusSecond) {
    if (vecFirst != null) {
      for (MenuVO mvo : vecFirst) {
        mvo.setFocus(false);
      }
    }
    if (vecSecond != null) {
      for (MenuVO mvo : vecSecond) {
        mvo.setFocus(false);
      }
    }

    if (focusFirst != null) {
      focusFirst.setFocus(true);
    } else if (vecFirst != null && vecFirst.get(0) != null) {
      vecFirst.get(0).setFocus(true);
    }

    if (focusSecond != null) {
      focusSecond.setFocus(true);
    } else if (vecSecond != null && vecSecond.get(0) != null) {
      vecSecond.get(0).setFocus(true);
    }
  }