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

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

Introduction

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

Prototype

public ModelAndView addObject(String attributeName, @Nullable Object attributeValue) 

Source Link

Document

Add an attribute to the model.

Usage

From source file:io.github.benas.todolist.web.controller.HomeController.java

@RequestMapping("/about")
public ModelAndView redirectToAboutPage() {
    ModelAndView modelAndView = new ModelAndView("about");
    modelAndView.addObject("aboutTabStyle", "active");
    return modelAndView;
}

From source file:it.jugpadova.controllers.JuggerSearchController.java

@RequestMapping
public ModelAndView search(@ModelAttribute("juggerSearch") JuggerSearch juggerSearch) {
    ModelAndView mv = new ModelAndView("jugger/admin/juggers");
    mv.addObject("juggers", juggerBo.searchJugger(juggerSearch));
    return mv;/*  w  w  w .j  av  a  2s .c o  m*/
}

From source file:nl.mok.mastersofcode.spectatorclient.controllers.RoundController.java

@RequestMapping(method = RequestMethod.GET, value = "/{id}")
public ModelAndView testDashboard(final HttpServletRequest request, @PathVariable int id) {
    ModelAndView mav = new ModelAndView();

    mav.addObject("page", new Object() {
        public String uri = "/spec/round";
        public String redirect = request.getRequestURL().toString();
    });/* ww w.ja v  a2s .  c o  m*/

    Round round = DataController.getRoundById(id).get();
    mav.addObject("round", round);
    mav.addObject("teams", DataController.getCompetitionById(round.getCompetition()).get().getTeams());
    mav.addObject("currentCompetition", DataController.getCurrentCompetition());
    mav.addObject("currentRound", DataController.getCurrentRound());
    mav.addObject("newsitems", newsitems);

    mav.setViewName("round.twig");

    return mav;
}

From source file:org.extremesite.controller.MessagesController.java

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    ModelAndView mv = new ModelAndView(successView);
    mv.addObject("options", options);
    Collection presidents = presidentsDao.getPresidents();
    mv.addObject("presidents", presidents);
    return mv;//from  ww w .j a va2s .  com
}

From source file:org.n52.aviation.aviationfx.spring.ExceptionHandlerImpl.java

private ModelAndView createModelAndView(Exception e, HttpServletRequest req) {
    LOG.warn("Returning exception", e);
    ModelAndView mav = new ModelAndView();
    mav.addObject(DEFAULT_ERROR_VIEW, e.getMessage());
    mav.addObject(BACKLINK, req.getRequestURL());
    mav.setViewName(DEFAULT_ERROR_VIEW);
    return mav;//  w  ww.  jav a  2  s.  c o  m
}

From source file:com.ignite.controller.TellerController.java

@RequestMapping(value = "/teller/client/{clientName}", method = RequestMethod.GET)
public ModelAndView clients(@PathVariable String clientName) {
    Client client = clientDao.getClient(clientName);
    List<Account> accounts = accountDao.getAccountsForClient(client);

    ModelAndView mav = new ModelAndView("clientDetail");
    mav.addObject("client", client);
    mav.addObject("accountList", accounts);
    return mav;//from w w w. j av  a2  s.com
}

From source file:com.kdgregory.pathfinder.test.spring3.pkg2.ControllerE.java

@RequestMapping(value = "/E2")
protected ModelAndView getBar(HttpServletRequest request, HttpServletResponse response,
        @RequestParam String argle, @RequestParam Integer bargle) throws Exception {
    ModelAndView mav = new ModelAndView("simple");
    mav.addObject("reqUrl", request.getRequestURI());
    mav.addObject("controller", getClass().getName());
    mav.addObject("argle", argle);
    mav.addObject("bargle", bargle);
    return mav;/*from ww  w .  ja  va2  s .  co  m*/
}

From source file:com.orca.web.DocumentationController.java

@RequestMapping(value = "documentation.html")
public ModelAndView documentation(@RequestParam("surveyId") Integer surveyId) {
    Survey survey = surveyService.getSurvey(surveyId);
    if (!surveyService.authorizedUser(survey)) {
        return new ModelAndView("notAuthorized");
    }/*from   w  w w.ja va2s. com*/
    ModelAndView mav = new ModelAndView("documentation");
    mav.addObject("documentation", survey.getDocumentation());
    mav.addObject("survey", survey);
    return mav;
}

From source file:edu.bbu.security.web.controllers.MainController.java

@RequestMapping(value = { "/", "/main**" }, method = RequestMethod.GET)
public ModelAndView welcomePage() {
    System.out.println("root lofasz");
    ModelAndView model = new ModelAndView();
    model.addObject("title", "Spring Security Custom Login Form");
    model.addObject("message", "This is welcome page!");
    model.setViewName("hello");
    return model;

}

From source file:eu.cloudwave.wp5.feedbackhandler.controller.MainController.java

@RequestMapping("/")
@ResponseStatus(HttpStatus.OK)// w  ww . j a  v  a 2s. co  m
@ResponseBody
public ModelAndView root() {
    sampleLogger.info(LOGGING_MSG);
    final ModelAndView model = new ModelAndView(ANGULAR_JSP_FILE);
    model.addObject("content", ROOT_CONTENT);
    return model;
}