/** * Destroy categoria. * * @param categoria the categoria * @return the model and view */ @RequestMapping(method = RequestMethod.GET, value = "/deletaCategoria") public ModelAndView destroyCategoria(final Long id) { categoriaService.removeCategoria(id); ModelAndView modelAndView = new ModelAndView("/categoria/categorias", "categorias", categoriaService.listCategorias()); modelAndView.setViewName("listaCategorias"); return modelAndView; }
/** * Index categoria. * * @return the model and view */ @RequestMapping(method = RequestMethod.GET, value = "/listaCategorias") public ModelAndView indexCategoria() { ModelAndView modelAndView = new ModelAndView("/categoria/categorias", "categoria", new Categoria()); PagedListHolder<Categoria> pagedListHolder = new PagedListHolder<Categoria>(categoriaService.listCategorias()); pagedListHolder.setPageSize(20); List<Categoria> pagedListCategorias = pagedListHolder.getPageList(); modelAndView.addObject("categorias", pagedListCategorias); modelAndView.setViewName("listaCategorias"); return modelAndView; }