Package com.ateam.webstore.ui.views

Examples of com.ateam.webstore.ui.views.View


     
      //Get the form and process
      FormSubmission results = processFormSubmission(req);
     
      //Set Result View
      View v = results.getResultView();
      v.setServletPath("admin");
      req.setAttribute(REQUEST_ATTRIBUTE_VIEW, results.getResultView());

      l.info(req.getAttribute(REQUEST_ATTRIBUTE_VIEW).toString());
     
      //Forward to JSP
View Full Code Here


   * @param admin True for the admin context
   * @return
   */
  public ProductListView getAllView(boolean admin) {
   
    View main = null;
   
    if (admin) {
      main = getMainAdminView();
    } else {
      main = getMainView();
View Full Code Here

   
    if (p == null) {
      p = getProduct(req.getParameter(Parameters.PRODUCT.getId()));
    }
   
    View main = null;
    String jsp = null;
    if (admin) {
      main = getMainAdminView();
      jsp = JSP_ADMIN_PRODUCT_DETAILS;
    }
View Full Code Here

     
      fs.setResultMessage(e.getMessage());
 
    }
   
    View fv = getProductView(true, p);
    fs.setResultView(fv);
   
    return fs;
  }
View Full Code Here

   
    String query = req.getParameter(Parameters.SEARCH_QUERY.getId());
   
    if (fs.validString(query)) {
     
      View main = null;
      if (admin) {
        main = getMainAdminView();
      }
      else {
        main = getMainView();
View Full Code Here

   
    l.info("Processing Login Request from session "+req.getSession().getId());
    Visitor v = login.getVistor();
   
    Customer cust = null;
    View resultView = null;
   
    try {
      cust = service.authenticateCustomer(req.getParameter(Parameters.EMAIL.getId()), req.getParameter(Parameters.PASSWORD.getId()));
      if (cust != null) {
        l.info("Login Successful for "+cust.getPerson().getLogin());
        v.setCustomer(cust);
        v.setAuthenticated(true);
        v.setKnown(true);
        v.setRemember(req.getParameter(Parameters.REMEMBER_ME.getId()) != null);
       
        req.getSession().setAttribute(SESSION_ATTRIBUTE_VISITOR, v);
        req.getSession().setAttribute(SESSION_ATTRIBUTE_USER_NAME, v.getEmail());
        login.setForm(FormName.LOGIN);
        login.setSuccess(true);

      }
      else {
        resultView = getLoginView("Invalid email or password. Please try again.", getMainView());
      }
     
    } catch (Exception e) {
      l.log(Level.INFO, "Failed authentication", e);
      resultView = getLoginView("Invalid email or password. Please try again.", getMainView());
    }

    if (v.isAuthenticated()) try {
      CartService cs = new CartService();
      l.info("retrieving cart for customerId:"+cust.getId());
      req.getSession().setAttribute(SESSION_ATTRIBUTE_CART, cs.getByCustomerId(cust.getId()));
     
      if (login.getRedirect() != null) {
        l.info("redirecting to "+login.getRedirect());
        resultView = new View();
        resultView.setRedirectPath(login.getRedirect());
      }
      else {
        resultView = processPostLogin();
      }
View Full Code Here

    }
    else if (service.customerExists(reg.getEmail())) {
      reg.setResultView(getRegistrationView("An account for"+reg.getEmail()+" already exists"));
    }
    else {
      View rv = new View(getMainView());
     
      rv.addContentView(new ContentView(JSP_LOGIN, "Login"));
     
      try {
        service.registerCustomer(reg.getFirstName(), reg.getLastName(), reg.getEmail(), reg.getPw(), reg.getSecurityQuestionIdLong(), reg.getSecurityAnswer());
        rv.setMessage("Registration Complete, please login.");
      } catch (Exception e) {
        l.log(Level.WARNING, "", e);
        rv.setError(true);
        //rv.setMessage("Failed!! "+e.getMessage());
        reg.setResultView(getRegistrationView("An error occured."));
      }

      reg.setResultView(rv);     
View Full Code Here

      }
      req.getSession().invalidate();
    }
   
    ProductHandler ph = new ProductHandler(req);
    View rv = ph.getHomePageView();
    return rv;
  }
View Full Code Here

    View rv = ph.getHomePageView();
    return rv;
  }

  public View getForgotPasswordView() {
    View v = new View(getMainView());
   
    v.addContentView(new ContentView(JSP_FORGOT_PASSWORD, "Password Recovery"));
    v.setShowLogonForm(false);
   
    return v;
  }
View Full Code Here

    return v;
  }

  public View getMyAccountView() {
   
    View v = new View(getMainView());
   
    v.addContentView(new ContentView(JSP_MY_ACCOUNT, "My Account"));
   
    return v;
  }
View Full Code Here

TOP

Related Classes of com.ateam.webstore.ui.views.View

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.