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:top.zhacker.passport.client.showcase.HomeController.java

@RequestMapping("/")
public String home(Principal currentUser, Model model) {
    model.addAttribute("connectionsToProviders", getConnectionRepository().findAllConnections());
    if (currentUser != null) {
        model.addAttribute(accountRepository.findAccountByUsername(currentUser.getName()));
    }// w w w.  j a  v  a  2 s . c o m
    return "home";
}

From source file:com.gopivotal.cla.web.SignatoryController.java

@Transactional(readOnly = true)
@RequestMapping(method = RequestMethod.GET, value = "/{organization}/{repository}")
String readRepository(@PathVariable String organization, @PathVariable String repository, Model model) {
    model.addAttribute("repository",
            this.linkedRepositoryRepository.findByOrganizationAndRepository(organization, repository));

    return "repository";
}

From source file:com.homeadvisor.kafdrop.controller.ClusterController.java

@RequestMapping("/")
public String allBrokers(Model model) {
    model.addAttribute("zookeeper", zookeeperProperties);
    model.addAttribute("brokers", kafkaMonitor.getBrokers());
    model.addAttribute("topics", kafkaMonitor.getTopics());
    return "cluster-overview";
}

From source file:cz.cvut.portal.kos.portlet.search.EditSearchController.java

@RenderMapping
public String render(Model model) {
    model.addAttribute(A.pref, SearchPreferences.load());

    return "edit";
}

From source file:com.cookbook.Controller.PrzepisyController.java

@RequestMapping(value = "/przepisy/{kat}")
public String index(@PathVariable String kat, HttpServletRequest request, Model m) {
    layout.addServices(m);/* w w w.j a va 2s  . com*/
    m.addAttribute("kat", kat);
    m.addAttribute("danieService", danieService);
    return "przepisy";
}

From source file:com.homeadvisor.kafdrop.controller.ClusterController.java

@ExceptionHandler(BrokerNotFoundException.class)
private String brokerNotFound(Model model) {
    model.addAttribute("zookeeper", zookeeperProperties);
    model.addAttribute("brokers", Collections.emptyList());
    model.addAttribute("topics", Collections.emptyList());
    return "cluster-overview";

}

From source file:com.kdubb.socialshowcaseboot.twitter.TwitterMessageController.java

@RequestMapping(value = "/twitter/messages", method = RequestMethod.GET)
public String inbox(Model model) {
    model.addAttribute("directMessages", twitter.directMessageOperations().getDirectMessagesReceived());
    model.addAttribute("dmListType", "Received");
    model.addAttribute("messageForm", new MessageForm());
    return "twitter/messages";
}

From source file:com.kdubb.socialshowcaseboot.twitter.TwitterMessageController.java

@RequestMapping(value = "/twitter/messages/sent", method = RequestMethod.GET)
public String sent(Model model) {
    model.addAttribute("directMessages", twitter.directMessageOperations().getDirectMessagesSent());
    model.addAttribute("dmListType", "Sent");
    model.addAttribute("messageForm", new MessageForm());
    return "twitter/messages";
}

From source file:com.redblackit.web.controller.AdminController.java

/**
 * Handle about request (designed for humans)
 * //from w w w . jav  a2s  . c  o  m
 * @param model to set attribute for view
 */
@RequestMapping("/about")
public void about(Model model) {
    model.addAttribute("versionInfo", versionInfo);
}

From source file:de.dominikschadow.javasecurity.controller.InterceptMeController.java

@GetMapping
public String home(Model model) {
    model.addAttribute("firstTask", new FirstTask());
    return "index";
}