/** * Register a new trader given the provided user Profile information such as address, email, etc. * Dispatch to the Trade Home JSP for display * * @param userID The User to create * @param passwd The User password * @param fullname The new User fullname info * @param ccn The new User credit card info * @param money The new User opening account balance * @param address The new User address info * @param email The new User email info * @return The userID of the new trader * @param ctx the servlet context * @param req the HttpRequest object * @param resp the HttpResponse object * @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 doRegister( ServletContext ctx, HttpServletRequest req, HttpServletResponse resp, String userID, String passwd, String cpasswd, String fullname, String ccn, String openBalanceString, String email, String address) throws ServletException, IOException { String results = ""; try { // Validate user passwords match and are atleast 1 char in length if ((passwd.equals(cpasswd)) && (passwd.length() >= 1)) { AccountDataBean accountData = tAction.register( userID, passwd, fullname, address, email, ccn, new BigDecimal(openBalanceString)); if (accountData == null) { results = "Registration operation failed;"; System.out.println(results); req.setAttribute("results", results); requestDispatch(ctx, req, resp, userID, TradeConfig.getPage(TradeConfig.REGISTER_PAGE)); } else { doLogin(ctx, req, resp, userID, passwd); results = "Registration operation succeeded; Account " + accountData.getAccountID() + " has been created."; req.setAttribute("results", results); } } else { // Password validation failed results = "Registration operation failed, your passwords did not match"; System.out.println(results); req.setAttribute("results", results); requestDispatch(ctx, req, resp, userID, TradeConfig.getPage(TradeConfig.REGISTER_PAGE)); } } catch (Exception e) { // log the exception with error page throw new ServletException( "TradeServletAction.doRegister(...)" + " exception user =" + userID, e); } }