Code example for ModelAndView

Methods: addObjectsetViewName

0
        this.orcidSearchManager = orcidSearchManager;
    } 
 
    @RequestMapping(value = "/search", method = RequestMethod.GET)
    public ModelAndView buildSearchView(@RequestParam(value = "activeTab", required = false) String activeTab) {
        ModelAndView mav = new ModelAndView();
        String tab = activeTab == null ? "OrcidBioSearch" : activeTab;
        mav.addObject("activeTab", tab);
        mav.setViewName("advanced_search");
        return mav;
    } 
 
    @RequestMapping(value = "/quick-search") 
    public ModelAndView quickSearch(@ModelAttribute("searchQuery") String queryFromUser, @ModelAttribute("solrQuery") String solrQuery) {
        ModelAndView mav = new ModelAndView("quick_search");
        if (StringUtils.isBlank(queryFromUser) && StringUtils.isBlank(solrQuery)) {
            incrementSearchMetrics(null); 
            mav.addObject("noResultsFound", true);
            return mav;
        }