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

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

Introduction

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

Prototype

public Map<String, Object> getModel() 

Source Link

Document

Return the model map.

Usage

From source file:org.openmrs.contrib.metadatarepository.webapp.controller.UserControllerTest.java

@Test
public void testSearch() throws Exception {
    compassGps.index();/*from   w  ww  .ja v  a  2  s . c  o  m*/
    ModelAndView mav = c.handleRequest("admin");
    Map m = mav.getModel();
    List results = (List) m.get(Constants.USER_LIST);
    assertNotNull(results);
    assertTrue(results.size() >= 1);
    assertEquals("admin/userList", mav.getViewName());
}

From source file:org.openmrs.contrib.metadatarepository.webapp.controller.PackageControllerTest.java

@Test
public void testSearch() throws Exception {
    compassGps.index();/*from ww  w .  j a  v a 2s .  co  m*/
    ModelAndView mav = c.handleRequest("HIV Lab");
    Map m = mav.getModel();
    List results = (List) m.get(Constants.PACKAGE_LIST);
    assertNotNull(results);
    assertTrue(results.size() >= 1);
    assertEquals("/mainMenu", mav.getViewName());
}

From source file:com.jeanchampemont.notedown.utils.PropertiesInterceptor.java

@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
        ModelAndView modelAndView) throws Exception {
    if (modelAndView != null) {
        modelAndView.getModel().put("notedownVersion", notedownVersion);
    }/*from www.  j  a  v a  2 s  . com*/
}

From source file:jetbrains.buildServer.importJenkins.web.JenkinsImportController.java

@Override
protected ModelAndView doGet(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response) {
    ModelAndView mv = new ModelAndView(myPagePath);
    mv.getModel().put("myPagePath", myPagePath);
    return mv;// w ww  .  ja va  2s  .  c  om
}

From source file:ru.org.linux.edithistory.EditHistoryController.java

@RequestMapping({ "/news/{group}/{id}/history", "/forum/{group}/{id}/history", "/gallery/{group}/{id}/history",
        "/polls/{group}/{id}/history" })
public ModelAndView showEditInfo(HttpServletRequest request, @PathVariable("id") int msgid) throws Exception {
    Topic message = messageDao.getById(msgid);

    List<PreparedEditHistory> editHistories = editHistoryService.prepareEditInfo(message, request.isSecure());

    ModelAndView modelAndView = new ModelAndView("history");

    modelAndView.getModel().put("message", message);
    modelAndView.getModel().put("editHistories", editHistories);

    return modelAndView;
}

From source file:ru.org.linux.edithistory.EditHistoryController.java

@RequestMapping({ "/news/{group}/{id}/{commentid}/history", "/forum/{group}/{id}/{commentid}/history",
        "/gallery/{group}/{id}/{commentid}/history", "/polls/{group}/{id}/{commentid}/history" })
public ModelAndView showCommentEditInfo(HttpServletRequest request, @PathVariable("id") int msgid,
        @PathVariable("commentid") int commentId) throws Exception {
    Topic message = messageDao.getById(msgid);
    Comment comment = commentService.getById(commentId);

    List<PreparedEditHistory> editHistories = editHistoryService.prepareEditInfo(comment, request.isSecure());

    ModelAndView modelAndView = new ModelAndView("history");

    modelAndView.getModel().put("message", message);
    modelAndView.getModel().put("editHistories", editHistories);

    return modelAndView;
}

From source file:org.guanxi.sp.engine.service.saml2.EmbeddedDiscoveryService.java

/**
 * This is the handler for the initial /s2/eds page
 *
 * @param request ServletRequest/*from  www  . jav  a  2s.  c  o m*/
 * @param response ServletResponse
 * @throws java.io.IOException if an error occurs
 */
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    DiscoveryFeedManager feedManager = (DiscoveryFeedManager) getServletContext()
            .getAttribute(Guanxi.CONTEXT_ATTR_ENGINE_DISCOVERY_FEED_MANAGER);
    ModelAndView mAndV = new ModelAndView();
    mAndV.setViewName("/saml2/eds");
    mAndV.getModel().put("jsonFeed", feedManager.toJSON());
    return mAndV;
}

From source file:org.hobsoft.contacts.server.controller.AuthenticationControllerTest.java

@Test
public void loginFormWithErrorAddsAttribute() {
    ModelAndView actual = controller.loginForm(null, "");

    assertEquals("error", actual.getModel().get("error"));
}

From source file:ch.silviowangler.dox.web.filters.DoxInterceptor.java

private boolean modelExists(ModelAndView modelAndView) {
    return modelAndView != null && modelAndView.getModel() != null;
}

From source file:org.hobsoft.contacts.server.controller.AuthenticationControllerTest.java

@Test
public void loginFormWithLogoutAddsAttribute() {
    ModelAndView actual = controller.loginForm("", null);

    assertEquals("logout", actual.getModel().get("logout"));
}