Skip to content

Commit

Permalink
파라미터로 들어온 문자열을 뷰에 보여줄 컨트롤러
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoochanhong committed Mar 19, 2023
1 parent 42fbd57 commit 5b6846d
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
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 Hello(Model model){
model.addAttribute("data","hello!!");
return "hello";
public String Hello(Model model) {
model.addAttribute("data", "hello!!");
return "hello";
}

@GetMapping("hello-mvc")
public String HelloMvc(@RequestParam(value = "name", required = true) String name, Model model) {
model.addAttribute("name", name);
return "hello-template";
}
}

0 comments on commit 5b6846d

Please sign in to comment.