@RequestMapping(value = "search.htm")
  public ModelAndView search(
      HttpServletRequest httpRequest, @ModelAttribute HolidayCriteria holiday) {
    if (logger.isInfoEnabled()) {
      logger.info(this.getClass().toString() + "-Search-");
    }
    ModelAndView mav = new ModelAndView();

    mav.addObject(BuckWaConstants.PAGE_SELECT, BuckWaConstants.LEAVE_INIT);

    mav.setViewName("holidayList");

    try {
      PagingBean bean = new PagingBean();
      int offset = ServletRequestUtils.getIntParameter(httpRequest, "pager.offset", 0);
      bean.setOffset(offset);
      BuckWaRequest request = new BuckWaRequest();
      request.put("pagingBean", bean);
      bean.put("holiday", holiday);

      BuckWaResponse response = yearService.getAll();
      List<Year> years = null;

      if (response.getStatus() == BuckWaConstants.SUCCESS) {
        years = (List) response.getResObj("yearList");

        response = holidayService.getByOffset(request);
        if (response.getStatus() == BuckWaConstants.SUCCESS) {
          PagingBean beanReturn = (PagingBean) response.getResObj("pagingBean");
          bean.setCurrentPageItem(beanReturn.getCurrentPageItem());
          bean.setTotalItems(beanReturn.getTotalItems());
          mav.addObject("pagingBean", bean);
          mav.addObject("doSearch", "true");
          if (years != null) {
            Calendar calendar = Calendar.getInstance();
            for (Year year : years) {
              calendar.set(Calendar.YEAR, Integer.parseInt(year.getName()));
              year.setName(
                  BuckWaDateUtils.getCustomFormat_thai_from_date(calendar.getTime(), "yyyy"));
            }
            mav.addObject("yearList", years);
          }
          mav.addObject("holidayCriteria", holiday);
        }
      } else {
        mav.addObject("errorCode", response.getErrorCode());
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      mav.addObject("errorCode", "E001");
    }
    return mav;
  }
  private ModelAndView gotoList(ModelAndView mav) {
    if (logger.isInfoEnabled()) {
      logger.info(this.getClass().toString() + "-goToList-");
    }
    mav.addObject(BuckWaConstants.PAGE_SELECT, BuckWaConstants.LEAVE_INIT);

    PagingBean bean = new PagingBean();

    mav.addObject("holidayCriteria", new HolidayCriteria());
    mav.addObject("pagingBean", bean);
    mav.setViewName("holidayList");

    int offset = 0;
    bean.setOffset(offset);
    BuckWaRequest request = new BuckWaRequest();
    request.put("pagingBean", bean);

    bean.put("holiday", new HolidayCriteria());

    BuckWaResponse response = yearService.getAll();
    List<Year> years = null;

    if (response.getStatus() == BuckWaConstants.SUCCESS) {
      years = (List) response.getResObj("yearList");

      response = holidayService.getByOffset(request);

      if (response.getStatus() == BuckWaConstants.SUCCESS) {
        PagingBean beanReturn = (PagingBean) response.getResObj("pagingBean");
        bean.setCurrentPageItem(beanReturn.getCurrentPageItem());
        bean.setTotalItems(beanReturn.getTotalItems());
        mav.addObject("pagingBean", bean);
        if (years != null) {
          Calendar calendar = Calendar.getInstance();
          for (Year year : years) {
            calendar.set(Calendar.YEAR, Integer.parseInt(year.getName()));
            year.setName(
                BuckWaDateUtils.getCustomFormat_thai_from_date(calendar.getTime(), "yyyy"));
          }
          mav.addObject("yearList", years);
        }
      }
    } else {
      mav.addObject("errorCode", response.getErrorCode());
    }
    return mav;
  }
  @RequestMapping(value = "delete.htm", method = RequestMethod.GET)
  public ModelAndView delete(
      @RequestParam("holidayId") String holidayId,
      HttpServletRequest httpRequest,
      @ModelAttribute HolidayCriteria holiday,
      @ModelAttribute PagingBean bean) {
    logger.info(" Start  ");
    ModelAndView mav = new ModelAndView();

    mav.addObject(BuckWaConstants.PAGE_SELECT, BuckWaConstants.LEAVE_INIT);

    mav.setViewName("holidayList");
    BuckWaRequest request = new BuckWaRequest();
    request.put("holidayId", holidayId);
    BuckWaResponse response = holidayService.deleteById(request);

    if (response.getStatus() == BuckWaConstants.SUCCESS) {
      mav.addObject("successCode", "S004");
    } else {
      mav.addObject("errorCode", response.getErrorCode());
      mav.addObject("pagingBean", bean);
    }

    int offset = ServletRequestUtils.getIntParameter(httpRequest, "pager.offset", 0);
    bean.setOffset(offset);
    request.put("pagingBean", bean);
    bean.put("holiday", holiday);
    response = holidayService.getByOffset(request);
    if (response.getStatus() == BuckWaConstants.SUCCESS) {
      PagingBean beanReturn = (PagingBean) response.getResObj("pagingBean");
      bean.setCurrentPageItem(beanReturn.getCurrentPageItem());
      bean.setTotalItems(beanReturn.getTotalItems());
      mav.addObject("pagingBean", bean);
    } else {
      mav.addObject("errorCode", response.getErrorCode());
    }

    return mav;
  }