Code example for ModelAndView

Methods: addObject

0
    @Autowired 
    ConfigurationServiceFacade configurationServiceFacade;
 
    @RequestMapping("restApprovalList.ftl") 
    public ModelAndView list() {
        ModelAndView mav = new ModelAndView("approval/list");
        List<BreadCrumbsLinks> breadcrumbs = new AdminBreadcrumbBuilder().withLink("View REST Approval List", "").build();
        mav.addObject("isApprovalRequired", RESTConfigKey.isApprovalRequired(configurationServiceFacade));
        mav.addObject("breadcrumbs", breadcrumbs);
        mav.addObject("waitingForApprovalList", approvalService.getAllWaiting());
        mav.addObject("approvedList", approvalService.getAllNotWaiting());
        return mav;
    } 
 
    @RequestMapping("restApproval/id-{id}/details.ftl") 
    public ModelAndView details(@PathVariable Long id) {
        ModelAndView mav = new ModelAndView("approval/details");
        mav.addObject("waitingForApprovalList", approvalService.getAllWaiting());
        RESTApprovalEntity approval = approvalService.getDetails(id);
        mav.addObject("approval", approval);