Example usage for org.springframework.ui Model addAttribute

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

Introduction

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

Prototype

Model addAttribute(String attributeName, @Nullable Object attributeValue);

Source Link

Document

Add the supplied attribute under the supplied name.

Usage

From source file:org.jboss.arquillian.spring.testsuite.beans.controller.EmployeeController.java

/**
 * <p>Handles request to the employee list.</p>
 *
 * @param model the employee list/*from  w  w w.j av  a 2s . c  o m*/
 * @return the view name
 */
@RequestMapping("/Employees.htm")
public String getEmployees(Model model) {

    model.addAttribute("employees", employeeService.getEmployees());

    return "employeeList";
}

From source file:org.jboss.spring3_2.example.ControllerAdvice.mvc.MemberController.java

@RequestMapping(method = RequestMethod.GET)
public String displaySortedMembers(Model model) {
    model.addAttribute("newMember", new Member());
    return "index";
}

From source file:org.lightadmin.logging.configurer.web.ApplicationController.java

@RequestMapping(value = "/", method = GET)
public String index(Model model) {
    model.addAttribute("baseUrl", absoluteBaseUrl());
    model.addAttribute("backToSiteUrl", loggingConfigurerSettings.getBackToSiteUrl());
    model.addAttribute("demoMode", loggingConfigurerSettings.isDemoMode());
    return "index";
}

From source file:org.osiam.security.controller.LoginController.java

@RequestMapping("/error")
public String loginError(Model model) {
    model.addAttribute("loginError", true);
    model.addAttribute("isLdapConfigured", isLdapConfigured);
    model.addAttribute("errorKey", "login.error");
    return "login";
}

From source file:com.greglturnquist.spring.social.ecobee.HomeController.java

@RequestMapping("/")
public String home(Principal currentUser, Model model) {

    model.addAttribute("connectionsToProviders", getConnectionRepository().findAllConnections());
    model.addAttribute("authentication", SecurityContextHolder.getContext().getAuthentication());
    return "home";
}

From source file:kievreclama.task.controllers.RootController.java

@RequestMapping(value = "/login", method = RequestMethod.GET)
public String getLoginForm(@RequestParam(value = "error", required = false) String error, Model model) {
    model.addAttribute("user", new UserModel());
    if (error != null) {
        model.addAttribute("error", "");
    }/* w  ww .  ja  v  a 2 s .c  o m*/
    return "login";
}

From source file:org.busko.routemanager.web.admin.gtfs.RouteController.java

void populateEditForm(Model uiModel, Route route) {
    uiModel.addAttribute("route", route);
    uiModel.addAttribute("agencys", Agency.findAllAgencys());
    //        uiModel.addAttribute("shapes", Shape.findAllShapes());
    //        uiModel.addAttribute("trips", Trip.findAllTrips());
}

From source file:org.tsugi.jpa.controllers.BaseController.java

/**
 * Just populate some common model stuff for less repeating
 *
 * @param req       the request//from   w w  w  . j  a v  a  2 s.c o m
 * @param principal the current security principal (if there is one)
 * @param model     the model
 */
void commonModelPopulate(HttpServletRequest req, Principal principal, Model model) {
    model.addAttribute("today", new Date());
    // a little extra request handling stuff
    model.addAttribute("req", req);
    model.addAttribute("reqURI", req.getMethod() + " " + req.getRequestURI());
}

From source file:com.github.carlomicieli.nerdmovies.controllers.HomeController.java

@RequestMapping(value = { "/", "/home" }, method = RequestMethod.GET)
public String index(Model model) {
    model.addAttribute("movies", movieService.getRecentMovies(10));
    return "home/index";
}

From source file:com.github.dbourdette.otto.web.controller.IndexController.java

@RequestMapping({ "/", "/index", "/sources" })
public String index(Model model) {
    model.addAttribute("groups", SourceGroups.findAllAutorized());

    return "index";
}