Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package br.ufc.mandacaru5.controller;
- import java.util.Arrays;
- import java.util.List;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.Model;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- @Controller
- public class WelcomeController {
- @Value("${welcome.message}")
- private String message;
- private List<String> tasks = Arrays.asList("a", "b", "c", "d", "e", "f", "g");
- @GetMapping("/")
- public String main(Model model) {
- model.addAttribute("message", message);
- model.addAttribute("tasks", tasks);
- return "welcome"; // view
- }
- @GetMapping("/hello")
- public String mainWithParam(@RequestParam(name = "name") String name, Model model) {
- model.addAttribute("message", name);
- return "welcome"; // view
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement