View Javadoc
1   package com.garbuz.web.controller;
2   
3   import org.springframework.stereotype.Controller;
4   import org.springframework.ui.Model;
5   import org.springframework.web.bind.annotation.GetMapping;
6   import org.springframework.web.bind.annotation.RequestParam;
7   
8   @Controller
9   public class HomeController {
10  
11      @GetMapping("/")
12      public String home(Model model) {
13          model.addAttribute("message", "Welcome to multi module project!");
14          model.addAttribute("title", "Main Page");
15          return "index";
16      }
17  
18      @GetMapping("/hello")
19      public String hello(@RequestParam(value = "name", defaultValue = "World") String name, 
20                         Model model) {
21          model.addAttribute("message", "Hello, " + name + "!");
22          model.addAttribute("title", "Hi there");
23          return "hello";
24      }
25  }