Exemple #1
0
  /**
   * Process the request and return an <code>ActionForward</code> instance describing where and how
   * control should be forwarded, or <code>null</code>if the response has already been completed.
   *
   * @param mapping The ActionMapping used to select this instance
   * @param form The optional ActionForm bean for this request (if any)
   * @param request The HTTP request we are processing
   * @param response The HTTP response we are creating
   * @exception Exception if the application logic throws an exception
   * @return the ActionForward for the next view
   */
  public ActionForward subSrvsDisplay(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    CommonLogger.logDebug(log, "In SupplierAction:create() ");

    // If user pressed 'Cancel' button,
    // return to home page

    if (isCancelled(request)) {
      return mapping.findForward("home");
    }

    try {
      // Get the list of all services available.
      ServiceManager svsMgr = new ServiceManager();
      List svsList = svsMgr.getAllServices();
      request.getSession().setAttribute(BSIConstants.SERVICES_LIST, svsList);
      // Get the list of all countries.
      List locnList = getCountriesList();
      request.setAttribute(BSIConstants.COUNTRY_LIST, locnList);

      SubscribeServiceForm ssform = (SubscribeServiceForm) form;
      ssform.reset(mapping, request);
      ArrayList locns = new ArrayList();

      LocationForm locform = null;

      for (int i = 0; i < 1; i++) {
        locform = new LocationForm();
        locns.add(locform);
      }

      ssform.populateForm(locns);

    } catch (BSIException ex1) {
      ActionErrors errors = new ActionErrors();
      CommonLogger.logDebug(
          log,
          "In SupplierAction:add() \n exception occured. Exception message is " + ex1.getMessage());
      errors.add(
          ActionErrors.GLOBAL_MESSAGE, new ActionMessage(ex1.getErrorCode(), ex1.getMessage()));
      saveErrors(request, errors);
    } catch (Exception ex2) {
      throw ex2;
    } finally {
      request.setAttribute(
          BSIConstants.ACTION_TYPE, request.getParameter(BSIConstants.ACTION_TYPE));
    }
    return mapping.findForward("success");
  }
Exemple #2
0
  public ActionForward create(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    CommonLogger.logDebug(log, "In PersonAction:create() ");

    // If user pressed 'Cancel' button,
    // return to home page

    if (isCancelled(request)) {
      return mapping.findForward("home");
    }

    try {
      // Get the list of all services available.
      ServiceManager svsMgr = new ServiceManager();
      List svsList = svsMgr.getAllServices();
      request.getSession().setAttribute(BSIConstants.SERVICES_LIST, svsList);
      // Get the list of all countries.
      List locnList = getCountriesList();
      request.getSession().setAttribute(BSIConstants.COUNTRY_LIST, locnList);
    } catch (BSIException ex1) {
      ActionErrors errors = new ActionErrors();
      CommonLogger.logDebug(
          log,
          "In PersonAction:add() \n exception occured. Exception message is " + ex1.getMessage());
      errors.add(
          ActionErrors.GLOBAL_MESSAGE, new ActionMessage(ex1.getErrorCode(), ex1.getMessage()));
      saveErrors(request, errors);
    } catch (Exception ex2) {
      throw ex2;
    } finally {
      request.setAttribute(BSIConstants.ACTION_TYPE, BSIConstants.CREATE);
    }
    return mapping.findForward("success");
  }