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:net.groupbuy.controller.admin.AttributeController.java

/**
 * /* w w  w .  j av  a2  s  . com*/
 */
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public String edit(Long id, ModelMap model) {
    model.addAttribute("productCategoryTree", productCategoryService.findTree());
    model.addAttribute("attributeValuePropertyCount", Product.ATTRIBUTE_VALUE_PROPERTY_COUNT);
    model.addAttribute("attribute", attributeService.find(id));
    return "/admin/attribute/edit";
}

From source file:org.wp.test.view.MyController.java

@RequestMapping(value = "/test", method = RequestMethod.GET)
public String handleRequestInternal(ModelMap model) throws Exception {
    //  ModelAndView model = new ModelAndView("test-templ");
    model.addAttribute("msg", "PHP and SPRING");
    model.addAttribute("msg1", "PHP");
    //Provider<Object> obj=null;
    return "org/wp/test/view/test-templ";
}

From source file:com.devnexus.ting.web.controller.EvaluationController.java

@RequestMapping(value = "/s/evaluations/add", method = RequestMethod.GET)
public String openAddEvaluations(ModelMap model) {
    model.addAttribute("evaluation", new Evaluation());
    prepareReferenceData(model);//  ww w.  j  av a  2s . c  o m
    return "add-evaluation";
}

From source file:com.yxz97.hr.web.controllers.PersonController.java

@RequestMapping(method = RequestMethod.GET)
public void form(ModelMap model) {
    Person person = new Person();
    model.addAttribute("person", person);
    logger.info("returning person/form");
}

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

@RequestMapping(value = { "/", "/list", "/list/" }, method = RequestMethod.GET)
@SiteTitle("{navigation.sourcedocument.list}")
public ModelAndView list() {
    ModelMap mm = new ModelMap();
    mm.addAttribute("sourceDocumentList", sourceDocumentService.getAllDocuments());

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

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

@RequestMapping(value = { "/create", "/create/" }, method = RequestMethod.GET)
@SiteTitle("{navigation.sourcedocument.create}")
public ModelAndView create() {
    ModelMap mm = new ModelMap();
    mm.addAttribute("sourceDocumentForm", new SourceDocumentForm());

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

From source file:org.opensprout.osaf.web.ContextGenericController.java

/**
 * This method handles ${urlbase}/update.do GET method request.
 * @param id Get an entity object by id, 
 * and put it to modelMap name in "model" that used by @SessionAttribute.
 * @param model ModelMap// w w  w  . ja  va2 s.co m
 * @param context Context type(C) object
 */
@RequestMapping(method = RequestMethod.GET)
public void update(int id, ModelMap model, C context) {
    model.addAttribute("model", service.get(id));
    model.addAttribute("context", context);
    model = addReference(model);
}

From source file:com.pkrete.locationservice.admin.controller.mvc.EditSubjectMatterController.java

@RequestMapping(method = RequestMethod.GET)
public String initializeForm(HttpServletRequest request, ModelMap model) throws Exception {
    model.addAttribute("languages", getOwner(request).getLanguages());
    String id = request.getParameter("select_subject");
    Owner owner = getOwner(request);
    SubjectMatter subject = subjectMattersService.getSubjectMatter(this.converterService.strToInt(id), owner);
    if (subject == null) {
        throw new ObjectNotFoundException(new StringBuilder("Subject matter not found. {\"id\":").append(id)
                .append(",\"owner\":\"").append(owner.getCode()).append("\"}").toString());
    }//from   www  . j  a v  a2 s  .c  om
    model.put("subject", subject);
    return "edit_subjectmatter";
}

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

@RequestMapping(value = { "/edit/{id}", "/edit/{id}/" }, method = RequestMethod.GET)
@SiteTitle("{entity.sourceDocument.edit}")
public ModelAndView editSourceDocument(@PathVariable Long id) {
    ModelMap mm = new ModelMap();
    mm.addAttribute("sourceDocumentForm",
            mapper.map(sourceDocumentService.getSourceDocumentByID(id), SourceDocument.class));

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

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

/**
 * // w  w  w .ja  v a2  s  . c  o m
 */
@RequestMapping(value = "/add", method = RequestMethod.GET)
public String add(ModelMap model) {
    model.addAttribute("articleCategoryTree", articleCategoryService.findTree());
    return "/admin/article_category/add";
}