• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

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

21.07.07 18:44 작성 조회수 786

0

답변 3

·

답변을 작성해보세요.

4

안녕하세요. 박종민님

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

감사합니다.

1

박종민님의 프로필

박종민

질문자

2021.07.08

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

1

박종민님의 프로필

박종민

질문자

2021.07.07

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