Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package controllers;
- 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 HelloController {
- @GetMapping("/hello")
- public String sayHello(@RequestParam(value = "name", required = false,
- defaultValue = "World") String name, Model model)
- {
- model.addAttribute("user", name);
- return "welcome";
- }
- }
Add Comment
Please, Sign In to add comment