개발/springboot 게시판 만들기
[springboot 게시판만들기] 2. Hello World 화면출력
잡다백과사전
2020. 6. 27. 08:29
반응형
testController 를 만들고 test.html 화면에 간단하게 "Hello world"를 출력해 보도록 하자.
controller 폴더를 만들고, 그안에 TestController.java 를 생성.
package com.jny.jboard.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class TestController {
@RequestMapping(value = "/test")
public String home(){
return "test.html";
}
}
src/main/resources/static 에 test.html 을 생성.
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
Hello world
</body>
</html>
실행후 접속하면 다음과 같이 성공
## 최초실행시 jdbc url 관련 오류가 발생해서 application.properties에 해당 정보를 넣어 주었다.
반응형