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:br.com.joaops.smt.controller.SystemUserPermissionController.java

@RequestMapping(value = "/add", method = RequestMethod.GET)
public ModelAndView add(HttpServletRequest request, HttpServletResponse response, Pageable p) {
    ModelAndView mav = new ModelAndView("/system/permission/add");
    mav.addObject("permission", systemUserPermissionService.newSystemUserPermission());
    mav.addObject("modules", systemModuleService.searchAllModules(p));//p ? mais que 10?
    mav.addObject("users", systemUserService.searchAllUsers(p));
    return mav;//w  w  w.j a  va  2 s .c o  m
}

From source file:br.com.semanticwot.cd.controllers.GatewayController.java

@ExceptionHandler({ GatewayWotNotCreated.class })
public ModelAndView handleError(HttpServletRequest req, Exception exception) {
    LOGGER.log(Level.WARNING, "Request: {0} raised {1}", new Object[] { req.getRequestURL(), exception });

    ModelAndView mav = new ModelAndView();
    mav.addObject("info", exception.getMessage());
    mav.addObject("gateway", new GatewayForm());
    mav.addObject("url", req.getRequestURL());
    mav.setViewName("gateway/form");
    return mav;//from w w  w.  j  a va2 s.  c o  m
}

From source file:com.castlemock.web.mock.rest.web.mvc.controller.method.DeleteRestMethodController.java

@PreAuthorize("hasAuthority('READER') or hasAuthority('MODIFIER') or hasAuthority('ADMIN')")
@RequestMapping(value = "/{restProjectId}/application/{restApplicationId}/resource/{restResourceId}/method/{restMethodId}/delete", method = RequestMethod.GET)
public ModelAndView defaultPage(@PathVariable final String restProjectId,
        @PathVariable final String restApplicationId, @PathVariable final String restResourceId,
        @PathVariable final String restMethodId) {
    final ReadRestMethodOutput output = serviceProcessor
            .process(new ReadRestMethodInput(restProjectId, restApplicationId, restResourceId, restMethodId));

    final ModelAndView model = createPartialModelAndView(PAGE);
    model.addObject(REST_PROJECT_ID, restProjectId);
    model.addObject(REST_APPLICATION_ID, restApplicationId);
    model.addObject(REST_RESOURCE_ID, restResourceId);
    model.addObject(REST_METHOD, output.getRestMethod());
    return model;
}

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

/**
 * Show update account form/*from  w w w .j  av  a  2  s  . c o m*/
 * 
 * @param model Objects and view
 * @return Form to update my account
 */
@RequestMapping(value = "/account/my-account", method = RequestMethod.GET)
public ModelAndView getUpdate(ModelAndView model) {
    model.addObject("user", new MyAccountValidator((User) userDAO.findById(getCurrentUser().getId())));
    model.setViewName("host/manage/account/my_account");
    return model;
}

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

/**
 * Show update account form//  w  w w . j  a  v  a  2s. co m
 * 
 * @param model Objects and view
 * @return Form to update my account
 */
@RequestMapping(value = "/account/my-account", method = RequestMethod.GET)
public ModelAndView getUpdate(ModelAndView model) {
    model.addObject("user", new MyAccountValidator((User) userDAO.findById(getCurrentUser().getId())));
    model.setViewName("participant/account/my_account");
    return model;
}

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

/**
 * Show the "Business and objectives" workshop part
 * // ww  w . ja  v a  2s.c o m
 * @param model Objects and view
 * @return Business and objectives view
 */
@RequestMapping(value = "/business-objectives/index", method = RequestMethod.GET)
public ModelAndView index(ModelAndView model) {
    int maxSentencesAmount = 3;

    model.addObject("maxSentencesAmount", maxSentencesAmount);
    model.addObject("workshopStep", CURRENT_STEP);
    model.setViewName("participant/business-objectives/index");
    return model;
}

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

/**
 * Show the "Ideate" workshop part/*from   ww  w . ja  v a2  s  .  co m*/
 * 
 * @param model Objects and view
 * @return Ideate view
 */
@RequestMapping(value = "/ideate/index", method = RequestMethod.GET)
public ModelAndView index(ModelAndView model) {
    int maxSentencesAmount = 3;

    model.addObject("maxSentencesAmount", maxSentencesAmount);
    model.addObject("workshopStep", CURRENT_STEP);
    model.setViewName("participant/ideate/index");
    return model;
}

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

/**
 * Show the "Mix and match" workshop part
 * //ww w .jav  a2s .co m
 * @param model Objects and view
 * @return Mix and match view
 */
@RequestMapping(value = "/mix-and-match/index", method = RequestMethod.GET)
public ModelAndView index(ModelAndView model) {
    int maxSentencesAmount = 3;

    model.addObject("maxSentencesAmount", maxSentencesAmount);
    model.addObject("workshopStep", CURRENT_STEP);
    model.setViewName("participant/mix-and-match/index");
    return model;
}

From source file:com.z.controllers.HomeController.java

@RequestMapping(value = "establecimientos/comentarios/{cueanexo}", method = RequestMethod.GET)
public ModelAndView comentarios(@PathVariable("cueanexo") int cueanexo) {
    ModelAndView mav = new ModelAndView("comentarios");
    mav.addObject("cuanexo", cueanexo);
    return mav;/*from   ww  w . j  a  v a  2  s  .  c o m*/
}

From source file:pl.altkom.text.mvc.spring.controller.PersonController.java

@RequestMapping("/list")
public ModelAndView list() {
    Iterable<Person> res = personDAO.findAll();

    ModelAndView model = new ModelAndView("personList");
    model.addObject("persons", res);

    return model;

}