인프런 커뮤니티 질문&답변
정적컨텐츠 관련 질문이요!
작성
·
297
0
@Controller
public class HelloController {
@GetMapping("hello-static")
public String hello(Model model) {
model.addAttribute("data", "hello!!");
return "hello";
}
}
위와 같이 컨트롤러를 만들었습니다.
따라서, localhost:8080/hello-static 을 입력하면
template/hello.html로 이동되게 설정했습니다.
하지만, localhost:8080/hello-static.html을 입력하면 template/hello.html로 이동되지 않고 static/hello-static.html로 이동이 됩니다.
강의 내용에 따르면 localhost:8080/hello-static.html을 입력했을 때 hello-static 관련 컨트롤러가 없는 경우에 static/hello-static.html로 이동된다고 하신것으로 기억합니다. 그런데 hello-static 컨트롤러가 있는데도 왜 static으로 가게 되는지 궁금합니다!
퀴즈
스프링 웹 개발의 세 가지 주요 방식인 정적 컨텐츠, MVC, API는 각각 어떤 결과를 주로 반환할까요?
정적 컨텐츠: 처리된 HTML, MVC: 가공되지 않은 파일, API: 데이터
정적 컨텐츠: 가공되지 않은 파일, MVC: 처리된 HTML, API: 데이터
정적 컨텐츠: 데이터, MVC: 가공되지 않은 파일, API: 처리된 HTML
정적 컨텐츠: 처리된 HTML, MVC: 데이터, API: 가공되지 않은 파일
답변 1
1






그러면 강의에서 말씀해주신 것 처럼 hello-static 관련 컨트롤러가 있어서 hello-static.html로 가지 않으려면 주소창에 어떻게 입력을 해야하나요?