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:io.spring.ScriptTemplateController.java

@RequestMapping("/")
String home(Model model) {
    model.addAttribute("title", "Title example");
    List comments = Arrays.asList(new Comment("author1", "content1"), new Comment("author2", "content2"),
            new Comment("author3", "content3"));
    model.addAttribute("comments", comments);
    return "home";
}

From source file:org.openmrs.module.odkconnector.web.controller.concept.ConfigurationListController.java

@RequestMapping(method = RequestMethod.GET)
public void preparePage(final Model model) {
    model.addAttribute("configurations", Context.getService(ConnectorService.class).getConceptConfigurations());
}

From source file:com.kdubb.socialshowcaseboot.facebook.FacebookFriendsController.java

@RequestMapping(value = "/facebook/friends", method = RequestMethod.GET)
public String showFeed(Model model) {
    model.addAttribute("friends", facebook.friendOperations().getFriendProfiles());
    return "facebook/friends";
}

From source file:com.zuoxiaolong.niubi.job.console.controller.MasterSlaveJobLogController.java

@RequestMapping(value = "")
public String list(Model model) {
    model.addAttribute("jobLogs", masterSlaveJobLogService.getAllJobLogs());
    return "master_slave_job_log_list";
}

From source file:com.zuoxiaolong.niubi.job.console.controller.MasterSlaveNodeController.java

@RequestMapping(value = "")
public String list(Model model) {
    model.addAttribute("nodes", masterSlaveNodeService.getAllNodes());
    return "master_slave_node_list";
}

From source file:com.zuoxiaolong.niubi.job.console.controller.StandbyJobLogController.java

@RequestMapping(value = "")
public String list(Model model) {
    model.addAttribute("jobLogs", standbyJobLogService.getAllJobLogs());
    return "standby_job_log_list";
}

From source file:com.zuoxiaolong.niubi.job.console.controller.StandbyNodeController.java

@RequestMapping(value = "")
public String list(Model model) {
    model.addAttribute("nodes", standbyNodeService.getAllNodes());
    return "standby_node_list";
}

From source file:devbury.dewey.core.web.Main.java

@RequestMapping("/")
public String index(Model model) {
    model.addAttribute("minutes", ChronoUnit.MINUTES.between(startTime, Instant.now()));
    return "core/index";
}

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

@RequestMapping("/broker/{id}")
public String brokerDetails(@PathVariable("id") int brokerId, Model model) {
    model.addAttribute("broker", kafkaMonitor.getBroker(brokerId)
            .orElseThrow(() -> new BrokerNotFoundException(String.valueOf(brokerId))));
    model.addAttribute("topics", kafkaMonitor.getTopics());
    return "broker-detail";
}

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

@RequestMapping("/{groupId:.+}")
public String consumerDetail(@PathVariable("groupId") String groupId, Model model) {
    model.addAttribute("consumer",
            kafkaMonitor.getConsumer(groupId).orElseThrow(() -> new ConsumerNotFoundException(groupId)));
    return "consumer-detail";
}