강의

멘토링

커뮤니티

Inflearn Community Q&A

ruho6460102044's profile image
ruho6460102044

asked

Spring for Beginners - Learn Spring Boot, Web MVC, and DB Access Technology with Code

MVC and Template Engines

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

Written on

·

953

0

404MVCspringjavaspring-boot

Answer 3

4

yh님의 프로필 이미지
yh
Instructor

안녕하세요. 박종민님

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

감사합니다.

1

ruho6460102044님의 프로필 이미지
ruho6460102044
Questioner

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

1

ruho6460102044님의 프로필 이미지
ruho6460102044
Questioner

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




ruho6460102044's profile image
ruho6460102044

asked

Ask a question