인프런 커뮤니티 질문&답변
퀴즈
46%나 틀려요. 한번 도전해보세요!
스프링 웹 개발의 세 가지 주요 방식인 정적 컨텐츠, MVC, API는 각각 어떤 결과를 주로 반환할까요?
정적 컨텐츠: 처리된 HTML, MVC: 가공되지 않은 파일, API: 데이터
정적 컨텐츠: 가공되지 않은 파일, MVC: 처리된 HTML, API: 데이터
정적 컨텐츠: 데이터, MVC: 가공되지 않은 파일, API: 처리된 HTML
정적 컨텐츠: 처리된 HTML, MVC: 데이터, API: 가공되지 않은 파일
답변 3
4
1
1
박종민
질문자
package controller;
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-mvc")
public String helloMvc(@RequestParam("name") String name, Model model) {
model.addAttribute("name", name);
return "hello-template";
}
}
//HelloController
<html xmlns:th="http://www.thymeleaf.org">
<body>
<p th:text="'hello ' + ${name}">hello! empty</p>
</body>
</html>
//hello-template.html





