/**
   * Display User Profile information such as address, email, etc. for the given Trader Dispatch to
   * the Trade Account JSP for display
   *
   * @param userID The User to display profile info
   * @param ctx the servlet context
   * @param req the HttpRequest object
   * @param resp the HttpResponse object
   * @param results A short description of the results/success of this web request provided on the
   *     web page
   * @exception javax.servlet.ServletException If a servlet specific exception is encountered
   * @exception javax.io.IOException If an exception occurs while writing results back to the user
   */
  void doAccount(
      ServletContext ctx,
      HttpServletRequest req,
      HttpServletResponse resp,
      String userID,
      String results)
      throws javax.servlet.ServletException, java.io.IOException {
    try {

      AccountDataBean accountData = tAction.getAccountData(userID);
      AccountProfileDataBean accountProfileData = tAction.getAccountProfileData(userID);
      ArrayList orderDataBeans =
          (TradeConfig.getLongRun() ? new ArrayList() : (ArrayList) tAction.getOrders(userID));

      req.setAttribute("accountData", accountData);
      req.setAttribute("accountProfileData", accountProfileData);
      req.setAttribute("orderDataBeans", orderDataBeans);
      req.setAttribute("results", results);
      requestDispatch(ctx, req, resp, userID, TradeConfig.getPage(TradeConfig.ACCOUNT_PAGE));
    } catch (java.lang.IllegalArgumentException e) { // this is a user error so I will
      // forward them to another page rather than throw a 500
      req.setAttribute("results", results + "could not find account for userID = " + userID);
      requestDispatch(ctx, req, resp, userID, TradeConfig.getPage(TradeConfig.HOME_PAGE));
      // log the exception with an error level of 3 which means, handled exception but would
      // invalidate a automation run
      Log.error(
          "TradeServletAction.doAccount(...)",
          "illegal argument, information should be in exception string",
          e);
    } catch (Exception e) {
      // log the exception with error page
      throw new ServletException(
          "TradeServletAction.doAccount(...)" + " exception user =" + userID, e);
    }
  }
  /**
   * Create the Trade Home page with personalized information such as the traders account balance
   * Dispatch to the Trade Home JSP for display
   *
   * @param ctx the servlet context
   * @param req the HttpRequest object
   * @param resp the HttpResponse object
   * @param results A short description of the results/success of this web request provided on the
   *     web page
   * @exception javax.servlet.ServletException If a servlet specific exception is encountered
   * @exception javax.io.IOException If an exception occurs while writing results back to the user
   */
  void doHome(
      ServletContext ctx,
      HttpServletRequest req,
      HttpServletResponse resp,
      String userID,
      String results)
      throws javax.servlet.ServletException, java.io.IOException {
    BigDecimal balance;
    String result = "";
    try {
      AccountDataBean accountData = tAction.getAccountData(userID);
      Collection holdingDataBeans = tAction.getHoldings(userID);

      // Edge Caching:
      // Getting the MarketSummary has been moved to the JSP
      // MarketSummary.jsp. This makes the MarketSummary a
      // standalone "fragment", and thus is a candidate for
      // Edge caching.
      // marketSummaryData = tAction.getMarketSummary();

      req.setAttribute("accountData", accountData);
      req.setAttribute("holdingDataBeans", holdingDataBeans);
      // See Edge Caching above
      // req.setAttribute("marketSummaryData", marketSummaryData);
      req.setAttribute("results", results);
    } catch (java.lang.IllegalArgumentException e) { // this is a user error so I will
      // forward them to another page rather than throw a 500
      req.setAttribute(
          "results", results + "check userID = " + userID + " and that the database is populated");
      requestDispatch(ctx, req, resp, userID, TradeConfig.getPage(TradeConfig.HOME_PAGE));
      // log the exception with an error level of 3 which means, handled exception but would
      // invalidate a automation run
      Log.error(
          "TradeServletAction.doHome(...)"
              + "illegal argument, information should be in exception string"
              + "treating this as a user error and forwarding on to a new page",
          e);
    }
    // ALPINE No support for EJB's yet
    /*catch (javax.ejb.FinderException e)
    {
    	//this is a user error so I will
    	//forward them to another page rather than throw a 500
    	req.setAttribute(
    		"results",
    		results + "\nCould not find account for + " + userID);
    	//requestDispatch(ctx, req, resp, TradeConfig.getPage(TradeConfig.HOME_PAGE));
    	//log the exception with an error level of 3 which means, handled exception but would invalidate a automation run
    	Log.error(
    		"TradeServletAction.doHome(...)" +
    		"Error finding account for user " + userID +
    		"treating this as a user error and forwarding on to a new page", e);
    }*/
    catch (Exception e) {
      // log the exception with error page
      throw new ServletException(
          "TradeServletAction.doHome(...)" + " exception user =" + userID, e);
    }

    requestDispatch(ctx, req, resp, userID, TradeConfig.getPage(TradeConfig.HOME_PAGE));
  }