Package org.springframework.ui

Examples of org.springframework.ui.ExtendedModelMap.addAttribute()


    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView handleRequest(@RequestParam(required = false, value = "q") String query) throws Exception {
        Model model = new ExtendedModelMap();
        try {
            model.addAttribute(Constants.USER_LIST, userManager.search(query));
        } catch (SearchException se) {
            model.addAttribute("searchError", se.getMessage());
            model.addAttribute(userManager.getUsers());
        }
        return new ModelAndView("admin/userList", model.asMap());
View Full Code Here


    public ModelAndView handleRequest(@RequestParam(required = false, value = "q") String query) throws Exception {
        Model model = new ExtendedModelMap();
        try {
            model.addAttribute(Constants.USER_LIST, userManager.search(query));
        } catch (SearchException se) {
            model.addAttribute("searchError", se.getMessage());
            model.addAttribute(userManager.getUsers());
        }
        return new ModelAndView("admin/userList", model.asMap());
    }
}
View Full Code Here

        Model model = new ExtendedModelMap();
        try {
            model.addAttribute(Constants.USER_LIST, userManager.search(query));
        } catch (SearchException se) {
            model.addAttribute("searchError", se.getMessage());
            model.addAttribute(userManager.getUsers());
        }
        return new ModelAndView("admin/userList", model.asMap());
    }
}
View Full Code Here

      }
      String attrName = AnnotationUtils.findAnnotation(attributeMethod, ModelAttribute.class).value();
      if ("".equals(attrName)) {
        attrName = Conventions.getVariableNameForReturnType(attributeMethod, attrValue);
      }
      implicitModel.addAttribute(attrName, attrValue);
    }

    Object[] args = argResolver.resolveArguments(
        handler, handlerMethod, request, response, webRequest, implicitModel, sessionAttrNames);
    ReflectionUtils.makeAccessible(handlerMethod);
View Full Code Here

  @Test
  public void handleModelReturnValue() throws Exception {
    mavContainer.addAttribute("attr1", "value1");
    Model returnValue = new ExtendedModelMap();
    returnValue.addAttribute("attr2", "value2");

    processor.handleReturnValue(returnValue , returnParamModel, mavContainer, webRequest);

    assertEquals("value1", mavContainer.getModel().get("attr1"));
    assertEquals("value2", mavContainer.getModel().get("attr2"));
View Full Code Here

  @NavigationMapping
  public NavigationOutcome onSubmitReview(Hotel hotel, ReviewDetails details) {
    /* Review review = */this.hotelService.addReview(hotel, details);
    // FIXME put something in flash scope to be displayed on hotel screen
    ModelMap model = new ExtendedModelMap();
    model.addAttribute("country", hotel.getCity().getCountry());
    model.addAttribute("city", hotel.getCity().getName());
    model.addAttribute("hotel", hotel.getName());
    return new NavigationOutcome("@hotel", model);
  }

View Full Code Here

  public NavigationOutcome onSubmitReview(Hotel hotel, ReviewDetails details) {
    /* Review review = */this.hotelService.addReview(hotel, details);
    // FIXME put something in flash scope to be displayed on hotel screen
    ModelMap model = new ExtendedModelMap();
    model.addAttribute("country", hotel.getCity().getCountry());
    model.addAttribute("city", hotel.getCity().getName());
    model.addAttribute("hotel", hotel.getName());
    return new NavigationOutcome("@hotel", model);
  }

  private Hotel getHotel(String country, String cityName, String hotelName) {
View Full Code Here

    /* Review review = */this.hotelService.addReview(hotel, details);
    // FIXME put something in flash scope to be displayed on hotel screen
    ModelMap model = new ExtendedModelMap();
    model.addAttribute("country", hotel.getCity().getCountry());
    model.addAttribute("city", hotel.getCity().getName());
    model.addAttribute("hotel", hotel.getName());
    return new NavigationOutcome("@hotel", model);
  }

  private Hotel getHotel(String country, String cityName, String hotelName) {
    City city = this.cityService.getCity(cityName, country);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.