-
카테고리
-
세부 분야
백엔드
-
해결 여부
미해결
똑같이 한거 같은데 404 오류가 뜨네요..
21.07.07 18:44 작성 조회수 786
0
답변을 작성해보세요.
4
1
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
답변 3