강의

멘토링

로드맵

인프런 커뮤니티 질문&답변

박종민님의 프로필 이미지
박종민

작성한 질문수

스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술

MVC와 템플릿 엔진

똑같이 한거 같은데 404 오류가 뜨네요..

작성

·

962

0

퀴즈

46%나 틀려요. 한번 도전해보세요!

스프링 웹 개발의 세 가지 주요 방식인 정적 컨텐츠, MVC, API는 각각 어떤 결과를 주로 반환할까요?

정적 컨텐츠: 처리된 HTML, MVC: 가공되지 않은 파일, API: 데이터

정적 컨텐츠: 가공되지 않은 파일, MVC: 처리된 HTML, API: 데이터

정적 컨텐츠: 데이터, MVC: 가공되지 않은 파일, API: 처리된 HTML

정적 컨텐츠: 처리된 HTML, MVC: 데이터, API: 가공되지 않은 파일

답변 3

4

김영한님의 프로필 이미지
김영한
지식공유자

안녕하세요. 박종민님

패키지도 완전히 맞추어주세요.

감사합니다.

1

박종민님의 프로필 이미지
박종민
질문자

감사합니다... controller 폴더를 hello.hellospring폴더 바깥에 만들어버렸네요 

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




박종민님의 프로필 이미지
박종민

작성한 질문수

질문하기