public void setLists(ModelAndView mv) {
   mv.addObject("frameColorList", frameColorSrv.getAllFrameColors());
   mv.addObject("frameMaterialList", frameMaterialSrv.getAllFrameMaterials());
   mv.addObject("frameTypeList", frameTypeSrv.getAllFrameTypes());
   mv.addObject("lensColorList", lensColorSrv.getAllLensColors());
   mv.addObject("lensMaterialList", lensMaterialSrv.getAllLensMaterials());
   mv.addObject("productSizeList", productSizeSrv.getAllProductSizes());
   mv.addObject("supplierList", supplierSrv.getAllSuppliers());
 }
  @RequestMapping(value = "/productListByFilterID")
  public ModelAndView productListByCatId(
      @RequestParam(value = "id") int id,
      @RequestParam(value = "bid") int bid,
      @RequestParam(value = "index") int index,
      HttpSession session) {
    ModelAndView mv = new ModelAndView("productList");
    mv.addObject("isUserClickByFilterID", "true");
    mv.addObject("listOfBrands", brandSrv.getAllBrands());
    if (session.getAttribute("cartSize") == null) {
      mv.addObject("cartSize", 0);
    } else {
      mv.addObject("cartSize", session.getAttribute("cartSize"));
    }

    int foundProducts = 0;
    if (index == 0) {
      mv.addObject("indexNumber", index);
      mv.addObject("resultList", categorySrv.getById(id));
      try {
        Category category = categorySrv.getById(id);
        Set<Product> product = category.getProduct();
        Iterator<Product> itr = product.iterator();
        while (itr.hasNext()) {
          Product prd = itr.next();
          foundProducts++;
        }
      } catch (Exception e) {

      }
    } else if (index == 1) {
      mv.addObject("indexNumber", index);
      mv.addObject("resultList", productSizeSrv.getById(id));
      try {
        ProductSize category = productSizeSrv.getById(id);
        Set<Product> product = category.getProduct();
        Iterator<Product> itr = product.iterator();
        while (itr.hasNext()) {
          Product prd = itr.next();
          foundProducts++;
        }
      } catch (Exception e) {

      }
    } else if (index == 2) {
      mv.addObject("indexNumber", index);
      mv.addObject("resultList", frameColorSrv.getById(id));
      try {
        FrameColor category = frameColorSrv.getById(id);
        Set<Product> product = category.getProduct();
        Iterator<Product> itr = product.iterator();
        while (itr.hasNext()) {
          Product prd = itr.next();
          foundProducts++;
        }
      } catch (Exception e) {

      }
    } else if (index == 3) {
      mv.addObject("indexNumber", index);
      mv.addObject("resultList", frameMaterialSrv.getById(id));
      try {
        FrameMaterial category = frameMaterialSrv.getById(id);
        Set<Product> product = category.getProduct();
        Iterator<Product> itr = product.iterator();
        while (itr.hasNext()) {
          Product prd = itr.next();
          foundProducts++;
        }
      } catch (Exception e) {

      }

    } else if (index == 4) {
      mv.addObject("indexNumber", index);
      mv.addObject("resultList", frameTypeSrv.getById(id));
      try {
        FrameType category = frameTypeSrv.getById(id);
        Set<Product> product = category.getProduct();
        Iterator<Product> itr = product.iterator();
        while (itr.hasNext()) {
          Product prd = itr.next();
          foundProducts++;
        }
      } catch (Exception e) {

      }

    } else if (index == 5) {
      mv.addObject("indexNumber", index);
      mv.addObject("resultList", lensColorSrv.getById(id));
      try {
        LensColor category = lensColorSrv.getById(id);
        Set<Product> product = category.getProduct();
        Iterator<Product> itr = product.iterator();
        while (itr.hasNext()) {
          Product prd = itr.next();
          foundProducts++;
        }
      } catch (Exception e) {

      }

    } else if (index == 6) {
      mv.addObject("indexNumber", index);
      mv.addObject("resultList", lensMaterialSrv.getById(id));
      try {
        LensMaterial category = lensMaterialSrv.getById(id);
        Set<Product> product = category.getProduct();
        Iterator<Product> itr = product.iterator();
        while (itr.hasNext()) {
          Product prd = itr.next();
          foundProducts++;
        }
      } catch (Exception e) {
      }
    }

    mv.addObject("brandList", brandSrv.getById(bid));
    mv.addObject("foundSize", foundProducts);
    setLists(mv);
    return mv;
  }