public ProductViewHelper getProductViewHelper(String type, 
			HttpServletRequest req) throws UnsupportedEncodingException {
		
		ProductViewHelper productViewHelper = new ProductViewHelper();
		
		if (req.getParameter("n") != null) {
			productViewHelper.setCurrentPage(
					Integer.parseInt(req.getParameter("n")));
		}
		else {
			productViewHelper.setCurrentPage(1);
		}
		
		ArrayList<Product> products = null;
		ProductDAO dao = DAOFactory.getInstance().getProductDAO();
		switch (type) {
		case HOME:
			products = dao.findAllProducts();
			break;

		case TOYS:
			products = dao.findAllToys();
			break;
			
		case GAMES:
			products = dao.findAllGames();
			break;
			
		case SEARCH:
			if (req.getParameter("keywords") != null) {
				String keyword = new String(req.getParameter("keywords")
						.getBytes("iso-8859-1"), "UTF-8");
				
				if (!"".equals(keyword) && !" ".equals(keyword)) {
					String[] keywords = keyword.split("\\s");
					
					products = DAOFactory.getInstance().getProductDAO()
							.searchByKeywords(keywords);
					
					productViewHelper.setKeyword(keyword);
				}
				else {
					products = new ArrayList<Product>();
					productViewHelper.setKeyword(" ");
				}
			}
			else {
				products = new ArrayList<Product>();
				productViewHelper.setKeyword(" ");
			}
			break;
		}

		Basket basket = (Basket)req.getSession().getAttribute("basket");
		
		productViewHelper.setProducts(products, basket);
		
		return productViewHelper;
	}