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:org.shareok.data.webserv.UserController.java

@RequestMapping("/newUser")
public ModelAndView newUserPage() {
    ModelAndView model = new ModelAndView();
    model.setViewName("newUser");

    return model;
}

From source file:gemlite.core.webapp.tools.BatchController.java

@RequestMapping(value = "/add")
    public ModelAndView getAdd() {
        ModelAndView view = new ModelAndView();
        view.setViewName(PAGE_PREFIX + "add");
        return view;
    }/*www .  ja  v  a2 s  .  co m*/

From source file:com.github.fedorchuck.webstore.web.controllers.GoodsController.java

@RequestMapping(value = "searchRequest", method = POST)
public ModelAndView processFindCommodity(UserActions commodity, ModelAndView model) {
    //TODO: add validation
    List<Commodity> commodities = commodityRepository.findByName(commodity.getSearchRequest());
    model.addObject("lists", commodities);
    model.setViewName("catalog");
    return model;
}

From source file:Highcharts.ExportController.java

@ExceptionHandler(TimeoutException.class)
    public ModelAndView handleTimeoutException(Exception ex) {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("error");
        modelAndView.addObject("message",
                "Timeout converting SVG, is your file this big, or maybe you have a syntax error in the javascript callback?");
        return modelAndView;
    }//from  ww w.j a va2 s.co  m

From source file:Highcharts.ExportController.java

@ExceptionHandler(PoolException.class)
    public ModelAndView handleServerPoolException(Exception ex) {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("error");
        modelAndView.addObject("message",
                "Sorry, the server is handling too many requests at the moment. Please try again.");
        return modelAndView;
    }/* w ww.  j  a v  a  2 s.  co m*/

From source file:Highcharts.ExportController.java

@ExceptionHandler(InterruptedException.class)
    public ModelAndView handleInterruptedException(Exception ex) {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("error");
        modelAndView.addObject("message",
                "It took too long time to process the options, no SVG is created. Make sure your javascript is correct");
        return modelAndView;
    }//  w  w  w .  j av  a 2  s  . c  o  m

From source file:org.shareok.data.webserv.UserController.java

@RequestMapping("/userProfile")
public ModelAndView userProfilePage(HttpServletRequest request) {

    ModelAndView model = new ModelAndView();
    model.setViewName("userProfile");

    return model;
}

From source file:org.owasp.webgoat.controller.Logout.java

/**
 * <p>logout.</p>/*  ww  w.  j  a va  2  s  .  c  om*/
 *
 * @param error a {@link java.lang.String} object.
 * @param logout a {@link java.lang.String} object.
 * @return a {@link org.springframework.web.servlet.ModelAndView} object.
 */
@RequestMapping(value = "logout.mvc", method = RequestMethod.GET)
public ModelAndView logout(@RequestParam(value = "error", required = false) String error,
        @RequestParam(value = "logout", required = false) String logout) {

    logger.info("Logging user out");

    ModelAndView model = new ModelAndView();
    if (error != null) {
        model.addObject("error", "Invalid username and password!");
    }

    if (logout != null) {
        model.addObject("msg", "You've been logged out successfully.");
    }
    model.setViewName("logout");

    return model;

}

From source file:com.klm.workshop.controller.host.manage.UserController.java

/**
 * Show create user form/*from  w  w w .j  a  v a2s. com*/
 * 
 * @param model Objects and view
 * @return Form to create a user
 */
@RequestMapping(value = "/users/create", method = RequestMethod.GET)
public ModelAndView getCreate(ModelAndView model) {
    model.addObject("user", new User());
    model.addObject("roles", User.Role.values());
    model.setViewName("host/manage/users/create");
    return model;
}