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:com.orchestra.portale.controller.DeleteDeepeningPageController.java

@RequestMapping(value = "/deldpage", params = "id")
public ModelAndView deletePoiById(@RequestParam(value = "id") String id) {
    try {/*from w w w .  ja v a 2  s  .c o m*/
        ModelAndView model = new ModelAndView("deleted");
        DeepeningPage poi = pm.findDeepeningPage(id);
        pm.deleteDeepeningPage(poi);
        return model;
    } catch (RuntimeException e) {
        ModelAndView model2 = new ModelAndView("errorViewPoi");
        model2.addObject("err", "Errore impossibile trovare il poi con id: " + id);
        return model2;
    }
}

From source file:io.hedwig.petclinic.ui.web.GeneralController.java

@RequestMapping(value = "/unauthorized")
public ModelAndView accessDenied() {
    logger.debug("In accessDenied");

    ModelAndView mav = new ModelAndView();
    mav.addObject("timestamp", new Date());
    mav.setViewName("unauthorized");
    return mav;/*from   w w  w  . jav a  2  s  .  c om*/
}

From source file:ru.org.linux.poll.PollBoxlet.java

@Override
@RequestMapping("/poll.boxlet")
protected ModelAndView getData(HttpServletRequest request) throws Exception {
    final Poll poll = pollDao.getCurrentPoll();

    Topic msg = messageDao.getById(poll.getTopicId());

    int count = pollDao.getVotersCount(poll.getId());

    int countUsers = pollDao.getCountUsers(poll);

    ModelAndView result = new ModelAndView("boxlets/poll");
    result.addObject("poll", poll);
    result.addObject("count", count);
    result.addObject("message", msg);
    result.addObject("countUsers", countUsers);
    return result;
}

From source file:com.castlemock.web.mock.rest.web.mvc.controller.mockresponse.RestMockResponseController.java

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

    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_ID, restMethodId);
    model.addObject(REST_MOCK_RESPONSE, output.getRestMockResponse());
    model.addObject(REST_MOCK_RESPONSE_STATUSES, RestMockResponseStatus.values());
    return model;
}

From source file:com.intel.cosbench.controller.web.WorkloadSubmissionController.java

private ModelAndView createErrResult(String msg) {
    ModelAndView result = new ModelAndView("submit");
    result.addObject("aInfos", controller.getActiveWorkloads());
    result.addObject("error", msg);
    return result;
}

From source file:com.intel.cosbench.driver.web.MissionSubmissionController.java

private ModelAndView createSuccResult(String id) {
    ModelAndView result = new ModelAndView("submit");
    result.addObject("aInfos", driver.getActiveMissions());
    result.addObject("submitted", "your mission has been accepted");
    result.addObject("id", id);
    return result;
}

From source file:com.leapfrog.lfaeventmanager.admin.controller.BookingController.java

@RequestMapping(value = "index", method = RequestMethod.GET)
public ModelAndView index() {
    ModelAndView mv = new ModelAndView("booking/index");
    mv.addObject("bookings", bookingService.getAll());
    return mv;/*from   w  ww  . j  a  v  a  2 s.  co m*/
}

From source file:com.library.bookarticlelibrary.controller.AuthorsController.java

@RequestMapping(value = "authors/author/editauthor/{authorId}", method = RequestMethod.GET)
public ModelAndView editAuthor(@PathVariable("authorId") int authorId) {
    Author author = authorDao.get(authorId);
    ModelAndView model = new ModelAndView("addauthor");
    model.addObject("title", "authors");
    model.addObject("author", author);

    return model;
}

From source file:com.orchestra.portale.controller.DeleteDeepeningPageController.java

@RequestMapping(value = "/deldpage", params = "name")
public ModelAndView deletePoi(@RequestParam(value = "name") String name) {
    ModelAndView model = new ModelAndView("deleted");
    try {/* w  w  w .j  a  v  a 2 s  . co m*/
        DeepeningPage poi = pm.findDeepeningPageByName(name);
        pm.deleteDeepeningPage(poi);

        return model;
    } catch (RuntimeException e) {
        ModelAndView model2 = new ModelAndView("errorViewPoi");
        model2.addObject("err", "Errore impossibile trovare il poi: " + name);
        return model2;
    }
}

From source file:it.geosolutions.geobatch.ui.mvc.FlowManagerDisposeController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    Catalog catalog = (Catalog) getApplicationContext().getBean("catalog");
    String fmId = request.getParameter("fmId");

    if (fmId != null) {
        FileBasedFlowManager fm = catalog.getResource(fmId, FileBasedFlowManager.class);

        if (fm != null) {
            fm.dispose();/*from ww w  .ja v  a 2  s  . c  o  m*/
            // catalog.getResourceThreadPool().remove((Runnable) fm);
            catalog.remove(fm);
        }
    }

    ModelAndView mav = new ModelAndView("flows");
    mav.addObject("flowManagers", catalog.getFlowManagers(FileBasedFlowManager.class));

    return mav;
}