Example usage for org.springframework.ui ModelMap addAttribute

List of usage examples for org.springframework.ui ModelMap addAttribute

Introduction

In this page you can find the example usage for org.springframework.ui ModelMap addAttribute.

Prototype

public ModelMap addAttribute(String attributeName, @Nullable Object attributeValue) 

Source Link

Document

Add the supplied attribute under the supplied name.

Usage

From source file:com.citrix.cpbm.portal.fragment.controllers.AbstractStaticPagesController.java

@RequestMapping(value = "/pages/contactUs", method = RequestMethod.GET)
public String contactUs(ModelMap map) {
    logger.debug("### In contactUs()  start method...");
    map.addAttribute("tenant", getTenant());
    logger.debug("### In contactUs()  end");
    return "main.contactus";
}

From source file:cz.muni.fi.mir.controllers.RevisionController.java

@RequestMapping(value = { "/", "/list/", "/list" }, method = RequestMethod.GET)
@SiteTitle("{navigation.revision.list}")
public ModelAndView list() {
    ModelMap mm = new ModelMap();
    mm.addAttribute("revisionList", revisionService.getAllRevisions());

    return new ModelAndView("revision_list", mm);
}

From source file:cz.muni.fi.mir.controllers.RevisionController.java

@RequestMapping(value = { "/create/", "/create" }, method = RequestMethod.GET)
@SiteTitle("{navigation.revision.create}")
public ModelAndView createRevision() {
    ModelMap mm = new ModelMap();
    mm.addAttribute("revisionForm", new RevisionForm());

    return new ModelAndView("revision_create", mm);
}

From source file:cz.muni.fi.mir.controllers.RevisionController.java

@RequestMapping(value = { "/edit/{id}", "/edit/{id}/" }, method = RequestMethod.GET)
@SiteTitle("{entity.revision.edit}")
public ModelAndView editRevision(@PathVariable Long id) {
    ModelMap mm = new ModelMap();
    mm.addAttribute("revisionForm", mapper.map(revisionService.getRevisionByID(id), RevisionForm.class));

    return new ModelAndView("revision_edit", mm);
}

From source file:cz.PA165.vozovyPark.controller.VehicleController.java

@RequestMapping(value = "/vehicle/new", method = RequestMethod.GET)
public String showAddVehicleForm(ModelMap model) {
    model.addAttribute("vehicle", new VehicleDTO());
    model.put("userClass", UserClassEnum.values());
    return "/vehicle/vehicleForm";
}

From source file:net.groupbuy.controller.admin.AttributeController.java

/**
 * //w w  w .j  av  a2 s.  c om
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String list(Pageable pageable, ModelMap model) {
    model.addAttribute("page", attributeService.findPage(pageable));
    return "/admin/attribute/list";
}

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

@RequestMapping(value = "/viewPackage*")
public ModelAndView viewPackage(MetadataPackage pkg, ModelMap map) {

    map.addAttribute("metadataPackage", packageManager.get(pkg.getId()));

    return new ModelAndView("/viewPackage");
}

From source file:org.openmrs.web.controller.encounter.AddressTemplateController.java

/**
 * Show AddressTemplate/*  ww  w .j a v  a2  s. c om*/
 */
@RequestMapping("/admin/locations/addressTemplate")
public void show(ModelMap model) {
    model.addAttribute("addressTemplateXml", Context.getLocationService().getAddressTemplate());
}

From source file:com.amediamanager.controller.MainController.java

@RequestMapping(value = "/login-failed", method = RequestMethod.GET)
public String loginerror(ModelMap model, HttpSession session) {
    model.addAttribute("error", "Login failed.");
    return home(model, session);
}

From source file:com.peadargrant.filecheck.web.controllers.SpecsController.java

@RequestMapping(method = RequestMethod.GET)
public String showSpecs(@RequestParam(value = "assignment", required = true) String assignmentCode,
        ModelMap model) throws Exception {

    model.addAttribute("assignmentsUrl", serverEnvironment.getPropertyAsString("assignmentsUrl"));

    Assignment assignment = getAssignmentForCode(assignmentCode);
    model.addAttribute(assignment);/* w  ww .j  ava 2s  .com*/

    CheckProvider checkProvider = new CheckProvider();
    HashMap<Check, CheckImplementation> checkDetails = new HashMap<>();
    for (Content content : assignment.getContent()) {
        for (Check check : content.getCheck()) {
            checkDetails.put(check, checkProvider.getImplementationForCheck(check));
        }
    }
    for (Pattern pattern : assignment.getPattern()) {
        for (Check check : pattern.getCheck()) {
            checkDetails.put(check, checkProvider.getImplementationForCheck(check));
        }
    }
    model.addAttribute("checkDetails", checkDetails);

    return "specs";
}