public void populateCategories() { categories = new ArrayList<Category>(); List<Category> categoryEntities = productService.getCategories(); setCategories(categoryEntities); }
public List<Category> getCategories() { categories = new ArrayList<Category>(); List<Category> categoryEntities = productService.getCategories(); categories.addAll(categoryEntities); return categories; }
public List<Product> getProductList() { Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String action = params.get("action"); String selectedCategory = params.get("selectedCategory"); System.out.println("action >>>>" + action); List<Product> products = productService.getProducts(Integer.valueOf(1)); setProductList(productList); this.productList = productList; this.value = "TESTING"; // return productList; return productList; }
public String displayProduct() { Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String action = params.get("action"); String selectedCategory = params.get("selectedCategory"); System.out.println("action >>>>" + action); List<Product> products = productService.getProducts(Integer.valueOf(selectedCategory)); setProductList(products); HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); request.getSession().setAttribute("productList", products); request.getSession().setAttribute("selectedCategoryId", selectedCategory); request.setAttribute("value", "VALUE"); this.productList = products; this.value = "TESTING"; return "productDetails"; }