Notice
Recent Posts
Recent Comments
«   2024/09   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Archives
Today
Total
관리 메뉴

충분히 쌓여가는

프로젝트 생성 및 기본 index 페이지 본문

Spring/project

프로젝트 생성 및 기본 index 페이지

빌드이너프 2023. 12. 24. 20:35

Spring Initializr

 

기본 구성

 

 

src>main>resources>templates에 index.html 생성

src>main>java>com.enough.project에 controller 패키지 생성>HomeController.java 생성

 

경로 지정

HomeController.java

@Controller
public class HomeController {

    @GetMapping("/")
    public String index() {
        return "index";
    }
}

 

css 파일 생성 및 폴더 지정

src>main>resources>static에 css 파일 생성(index.css)

h1 {
    color:blue;
}

 

 

index.htm에 head 사이 <link> ~ </link> 입력

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Index Page</title>
    <link rel="stylesheet" href="index.css">
</head>
<body>
<h1>index page</h1>
</body>
</html>

 

프로젝트 실행(localhost:8080)

'Spring > project' 카테고리의 다른 글

글 작성 view 구현  (0) 2023.12.25
게시판 기능(CRUD)  (0) 2023.12.25
스프링 시큐리티를 사용한 인증, 인가  (0) 2023.12.25
게시판 리스트 페이지 생성  (0) 2023.12.24
thymeleaf를 사용하여 레이아웃 적용  (0) 2023.12.24