Example usage for org.springframework.web.servlet ModelAndView setViewName

List of usage examples for org.springframework.web.servlet ModelAndView setViewName

Introduction

In this page you can find the example usage for org.springframework.web.servlet ModelAndView setViewName.

Prototype

public void setViewName(@Nullable String viewName) 

Source Link

Document

Set a view name for this ModelAndView, to be resolved by the DispatcherServlet via a ViewResolver.

Usage

From source file:com.rakesh.rp3599.controller.ExceptionHandlingController.java

@ExceptionHandler({ Exception.class, AgencyNotFoundException.class })
public ModelAndView handleError(HttpServletRequest req, Exception exception) {
    ModelAndView mav = new ModelAndView();
    mav.addObject("exception", exception);
    mav.addObject("url", req.getRequestURL());
    mav.setViewName("error");
    return mav;/*  ww w  .  j  ava  2 s . c  om*/
}

From source file:eu.trentorise.smartcampus.permissionprovider.controller.GlobalDefaultExceptionHandler.java

public ModelAndView resolveException(HttpServletRequest aReq, HttpServletResponse aRes, Object aHandler,
        Exception anExc) {//from w  w  w . j a  v  a 2s .  com
    // Otherwise setup and send the user to a default error-view.
    ModelAndView mav = new ModelAndView();
    mav.addObject("exception", anExc);
    mav.addObject("url", aReq.getRequestURL());
    mav.setViewName(DEFAULT_ERROR_VIEW);
    return mav;
}

From source file:de.fau.amos4.web.ClientController.java

@RequestMapping(value = "/client/dashboard")
public ModelAndView ClientDashboard(Principal principal) {
    ModelAndView mav = new ModelAndView();
    mav.setViewName("client/dashboard");

    final String currentUser = principal.getName();
    Client client = clientService.getClientByEmail(currentUser);
    Iterable<Employee> clientsEmployees = employeeRepository.findByClient(client);

    mav.addObject("Employees", clientsEmployees);
    return mav;/* w w w.ja  v  a 2 s .  c o m*/
}

From source file:br.com.helio.pocspringmvc.web.ProdutoController.java

@RequestMapping(value = "/lista", method = RequestMethod.GET)
public ModelAndView showPersons() {
    ModelAndView modelAndView = new ModelAndView();
    modelAndView.addObject("produtos", produtService.findAll());
    modelAndView.setViewName("produto/lista");

    return modelAndView;
}

From source file:bc8.movies.controllers.LoginController.java

@RequestMapping(value = "/editUser")
public ModelAndView editUser(String user, HttpSession session) {
    ModelAndView mv = new ModelAndView("editUser");
    if (session.getAttribute("user") == null) {
        mv.setViewName("redirect:/home");
    }/*ww w.  j  a  v  a 2 s.com*/

    return mv;
}

From source file:br.com.contratempo.controller.ClienteController.java

@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ModelAndView detalhesTurma(@PathVariable("id") Long id) {
    Cliente cliente = repository.findOne(id);
    ModelAndView model = new ModelAndView();
    model.setViewName("aluno/aluno-detalhe");
    model.addObject("clienteDetalhe", cliente);
    return model;
}

From source file:com.bsg.pcms.sale.company.CompanyContractController.java

private ModelAndView saleContractListMAV(List<CompanyContractDTOEx> saleCompanyContractList, int totalCount) {
    ModelAndView mav = new ModelAndView();
    mav.setViewName(_bigstarConstant.VW_SALE_COMPANY_CONTRACT_LIST);
    mav.addObject(_bigstarConstant.OB_LEFT_MENU_SEQ, _bigstarConstant.LEFT_SALE_COMPANY_CONTRACT);
    mav.addObject(_bigstarConstant.OB_NAV_SEQ, _bigstarConstant.HEADER_SALE_COMPANY);
    mav.addObject(_bigstarConstant.OB_SALE_COMPANY_CONTRACT_LIST, saleCompanyContractList);
    mav.addObject("totalCount", totalCount);
    return mav;/*  www .  j  a v  a  2s.  c  o  m*/
}

From source file:com.klm.workshop.controller.participant.BusinessAndObjectivesController.java

/**
 * Show form to update a business objective
 *
 * @param model Objects and view//w  ww . j  a v  a 2s.co  m
 * @param id The ID of the workshop to update
 * @return Form to update a business objective
 */
@RequestMapping(value = "/business-objectives/update/{id}", method = RequestMethod.GET)
public ModelAndView update(ModelAndView model, @PathVariable int id) {
    model.addObject("workshopStep", CURRENT_STEP);
    model.setViewName("participant/business-objectives/update");
    return model;
}

From source file:com.klm.workshop.controller.participant.IdeateController.java

/**
 * Show form to update a ideate sentence
 *
 * @param model Objects and view//from w w  w.  ja  v a2  s. c  o  m
 * @param id The ID of the workshop to update
 * @return Form to update a ideate sentence
 */
@RequestMapping(value = "/ideate/update/{id}", method = RequestMethod.GET)
public ModelAndView update(ModelAndView model, @PathVariable int id) {
    model.addObject("workshopStep", CURRENT_STEP);
    model.setViewName("participant/ideate/update");
    return model;
}

From source file:com.klm.workshop.controller.participant.MixAndMatchController.java

/**
 * Show form to update a mix and match sentence
 * /*from  w w w.  ja v  a2  s  . c  o m*/
 * @param model Objects and view
 * @param id The ID of the workshop to update
 * @return Form to update a mix and match sentence
 */
@RequestMapping(value = "/mix-and-match/update/{id}", method = RequestMethod.GET)
public ModelAndView update(ModelAndView model, @PathVariable int id) {
    model.addObject("workshopStep", CURRENT_STEP);
    model.setViewName("participant/mix-and-match/update");
    return model;
}