Package org.springframework.beans.support

Examples of org.springframework.beans.support.PagedListHolder


    if (account == null) {
      return new ModelAndView("Error", "message", "Invalid username or password.  Signon failed.");
    }
    else {
      UserSession userSession = new UserSession(account);
      PagedListHolder myList = new PagedListHolder(this.petStore.getProductListByCategory(account.getFavouriteCategoryId()));
      myList.setPageSize(4);
      userSession.setMyList(myList);
      request.getSession().setAttribute("userSession", userSession);
      String forwardAction = request.getParameter("forwardAction");
      if (forwardAction != null) {
        response.sendRedirect(forwardAction);
View Full Code Here


    String keyword = request.getParameter("keyword");
    if (keyword != null) {
      if (!StringUtils.hasLength(keyword)) {
        return new ModelAndView("Error", "message", "Please enter a keyword to search for, then press the search button.");
      }
      PagedListHolder productList = new PagedListHolder(this.petStore.searchProductList(keyword.toLowerCase()));
      productList.setPageSize(4);
      request.getSession().setAttribute("SearchProductsController_productList", productList);
      return new ModelAndView("SearchProducts", "productList", productList);
    }
    else {
      String page = request.getParameter("page");
      PagedListHolder productList = (PagedListHolder) request.getSession().getAttribute("SearchProductsController_productList");
      if (productList == null) {
        return new ModelAndView("Error", "message", "Your session has timed out. Please start over again.");
      }
      if ("next".equals(page)) {
        productList.nextPage();
      }
      else if ("previous".equals(page)) {
        productList.previousPage();
      }
      return new ModelAndView("SearchProducts", "productList", productList);
    }
  }
View Full Code Here

  public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
    Map model = new HashMap();
    String categoryId = request.getParameter("categoryId");
    if (categoryId != null) {
      Category category = this.petStore.getCategory(categoryId);
      PagedListHolder productList = new PagedListHolder(this.petStore.getProductListByCategory(categoryId));
      productList.setPageSize(4);
      request.getSession().setAttribute("ViewProductAction_category", category);
      request.getSession().setAttribute("ViewProductAction_productList", productList);
      model.put("category", category);
      model.put("productList", productList);
    }
    else {
      Category category = (Category) request.getSession().getAttribute("ViewProductAction_category");
      PagedListHolder productList = (PagedListHolder) request.getSession().getAttribute("ViewProductAction_productList");
      if (category == null || productList == null) {
        throw new IllegalStateException("Cannot find pre-loaded category and product list");
      }
      String page = request.getParameter("page");
      if ("next".equals(page)) {
        productList.nextPage();
      }
      else if ("previous".equals(page)) {
        productList.previousPage();
      }
      model.put("category", category);
      model.put("productList", productList);
    }
    return new ModelAndView("Category", model);
View Full Code Here

  public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
    Map model = new HashMap();
    String productId = request.getParameter("productId");
    if (productId != null) {
      PagedListHolder itemList = new PagedListHolder(this.petStore.getItemListByProduct(productId));
      itemList.setPageSize(4);
      Product product = this.petStore.getProduct(productId);
      request.getSession().setAttribute("ViewProductAction_itemList", itemList);
      request.getSession().setAttribute("ViewProductAction_product", product);
      model.put("itemList", itemList);
      model.put("product", product);
    }
    else {
      PagedListHolder itemList = (PagedListHolder) request.getSession().getAttribute("ViewProductAction_itemList");
      Product product = (Product) request.getSession().getAttribute("ViewProductAction_product");
      String page = request.getParameter("page");
      if ("next".equals(page)) {
        itemList.nextPage();
      }
      else if ("previous".equals(page)) {
        itemList.previousPage();
      }
      model.put("itemList", itemList);
      model.put("product", product);
    }
    return new ModelAndView("Product", model);
View Full Code Here

          "User ID already exists: choose a different ID.");
      return showForm(request, response, errors);
    }
   
    UserSession userSession = new UserSession(this.petStore.getAccount(accountForm.getAccount().getUsername()));
    PagedListHolder myList = new PagedListHolder(
        this.petStore.getProductListByCategory(accountForm.getAccount().getFavouriteCategoryId()));
    myList.setPageSize(4);
    userSession.setMyList(myList);
    request.getSession().setAttribute("userSession", userSession);
    return super.onSubmit(request, response, command, errors);
  }
View Full Code Here

    if (keyword != null) {
      if (!StringUtils.hasLength(keyword)) {
        request.setAttribute("message", "Please enter a keyword to search for, then press the search button.");
        return mapping.findForward("failure");
      }
      PagedListHolder productList = new PagedListHolder(getPetStore().searchProductList(keyword.toLowerCase()));
      productList.setPageSize(4);
      request.getSession().setAttribute("SearchProductsAction_productList", productList);
      request.setAttribute("productList", productList);
      return mapping.findForward("success");
    }
    else {
      String page = request.getParameter("page");
      PagedListHolder productList = (PagedListHolder) request.getSession().getAttribute("SearchProductsAction_productList");
      if (productList == null) {
        request.setAttribute("message", "Your session has timed out. Please start over again.");
        return mapping.findForward("failure");
      }
      if ("next".equals(page)) {
        productList.nextPage();
      }
      else if ("previous".equals(page)) {
        productList.previousPage();
      }
      request.setAttribute("productList", productList);
      return mapping.findForward("success");
    }
  }
View Full Code Here

        String forwardAction = acctForm.getForwardAction();
        acctForm = new AccountActionForm();
        acctForm.setForwardAction(forwardAction);
        acctForm.setAccount(account);
        acctForm.getAccount().setPassword(null);
        PagedListHolder myList = new PagedListHolder(getPetStore().getProductListByCategory(account.getFavouriteCategoryId()));
        myList.setPageSize(4);
        acctForm.setMyList(myList);
        request.getSession().setAttribute("accountForm", acctForm);
        if (acctForm.getForwardAction() == null || acctForm.getForwardAction().length() < 1) {
          return mapping.findForward("success");
        }
View Full Code Here

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    String categoryId = request.getParameter("categoryId");
    if (categoryId != null) {
      Category category = getPetStore().getCategory(categoryId);
      PagedListHolder productList = new PagedListHolder(getPetStore().getProductListByCategory(categoryId));
      productList.setPageSize(4);
      request.getSession().setAttribute("ViewProductAction_category", category);
      request.getSession().setAttribute("ViewProductAction_productList", productList);
      request.setAttribute("category", category);
      request.setAttribute("productList", productList);
    }
    else {
      Category category = (Category) request.getSession().getAttribute("ViewProductAction_category");
      PagedListHolder productList = (PagedListHolder) request.getSession().getAttribute("ViewProductAction_productList");
      if (category == null || productList == null) {
        throw new IllegalStateException("Cannot find pre-loaded category and product list");
      }
      String page = request.getParameter("page");
      if ("next".equals(page)) {
        productList.nextPage();
      }
      else if ("previous".equals(page)) {
        productList.previousPage();
      }
      request.setAttribute("category", category);
      request.setAttribute("productList", productList);
    }
    return mapping.findForward("success");
View Full Code Here

public class ViewProductAction extends BaseAction {

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    String productId = request.getParameter("productId");
    if (productId != null) {
      PagedListHolder itemList = new PagedListHolder(getPetStore().getItemListByProduct(productId));
      itemList.setPageSize(4);
      Product product = getPetStore().getProduct(productId);
      request.getSession().setAttribute("ViewProductAction_itemList", itemList);
      request.getSession().setAttribute("ViewProductAction_product", product);
      request.setAttribute("itemList", itemList);
      request.setAttribute("product", product);
    }
    else {
      PagedListHolder itemList = (PagedListHolder) request.getSession().getAttribute("ViewProductAction_itemList");
      Product product = (Product) request.getSession().getAttribute("ViewProductAction_product");
      String page = request.getParameter("page");
      if ("next".equals(page)) {
        itemList.nextPage();
      }
      else if ("previous".equals(page)) {
        itemList.previousPage();
      }
      request.setAttribute("itemList", itemList);
      request.setAttribute("product", product);
    }
    return mapping.findForward("success");
View Full Code Here

      acctForm.getAccount().setListOption(request.getParameter("account.listOption") != null);
      acctForm.getAccount().setBannerOption(request.getParameter("account.bannerOption") != null);
      Account account = acctForm.getAccount();
      getPetStore().updateAccount(account);
      acctForm.setAccount(getPetStore().getAccount(account.getUsername()));
      PagedListHolder myList = new PagedListHolder(getPetStore().getProductListByCategory(account.getFavouriteCategoryId()));
      myList.setPageSize(4);
      acctForm.setMyList(myList);
      request.getSession().setAttribute("accountForm", acctForm);
      request.getSession().removeAttribute("workingAccountForm");
      return mapping.findForward("success");
    }
View Full Code Here

TOP

Related Classes of org.springframework.beans.support.PagedListHolder

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.