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(Object attributeValue) 

Source Link

Document

Add the supplied attribute to this Map using a org.springframework.core.Conventions#getVariableName generated name .

Usage

From source file:com.securejobs.web.AgentProfileController.java

@RequestMapping(method = RequestMethod.GET)
public String getCurrentPage(ModelMap model) {
    Persons person = new Persons();
    model.addAttribute(person);
    return "Agent-MyProfile";
}

From source file:com.securejobs.web.JobseekerProfileController.java

@RequestMapping(method = RequestMethod.GET)
public String getCurrentPage(ModelMap model) {
    Persons person = new Persons();
    model.addAttribute(person);
    return "Jobseeker-MyProfile";
}

From source file:org.motechproject.server.omod.web.controller.DuplicatePatientController.java

@RequestMapping(value = "/module/motechmodule/duplicatepatients", method = RequestMethod.GET)
public String viewForm(ModelMap modelMap) {
    modelMap.addAttribute(new WebDuplicatePatients());

    List<Patient> list = contextService.getMotechService().getAllDuplicatePatients();
    modelMap.addAttribute("duplicate_patients", list);
    return "/module/motechmodule/duplicatepatients";
}

From source file:com.realestate.controller.LoginController.java

/**
 * Method retrieves the registration form.
 * @param user/*from  w w  w  .  j a  v a  2s  .  co m*/
 * @param model
 * @return
 */
@RequestMapping(value = "/register.htm")
public String showRegisterForm(@ModelAttribute("user") User user, ModelMap model) {

    model.addAttribute(user);

    return "redirect:registerPage.htm";
}

From source file:com.realestate.controller.RegisterController.java

/**
 * Sets up the page with blank data for the registrants/placeholder for registrant;
 * registrant page is displayed/*ww  w  . j  a  va 2  s.  c  om*/
 * @param model
 * @return
 */
@RequestMapping(value = "/registerPage.htm")
public String showRegisterForm(ModelMap model) {
    Prospect prospect = new Prospect();
    model.addAttribute(prospect);
    Registrant registrant = new Registrant();
    model.addAttribute(registrant);

    return "registerPage";
}

From source file:com.realestate.controller.LoginController.java

/**
 * Retrieves login page/*  ww  w  .j  av a  2s . co  m*/
 * @param model
 * @return
 */
@RequestMapping(value = "/frontPage.htm", method = RequestMethod.GET)
public String showUserForm(ModelMap model) {
    User user = new User();
    model.addAttribute(user);

    return "loginPage";
}

From source file:com.trenako.web.controllers.AuthController.java

@RequestMapping(value = "/signup", method = RequestMethod.POST)
public String createUser(@Valid @ModelAttribute Account account, BindingResult result, ModelMap model) {

    if (result.hasErrors()) {
        model.addAttribute(account);
        return "auth/signup";
    }//  w  w  w. j  av a 2s. c  om

    try {
        Account newUser = signupService.createAccount(account);

        // automatically sign in the new user
        signupService.authenticate(newUser);

        return "redirect:/default";
    } catch (DuplicateKeyException ex) {
        model.addAttribute(account);
        EMAIL_ADDRESS_OR_DISPLAY_NAME_ALREADY_TAKEN.appendToModel(model);
        return "auth/signup";
    }
}