반응형

정적 페이지 생성 예제

  1. Spring Boot 프로젝트의 src\main\resources\static 폴더 안에 index.html, staticpage.html 파일 생성
  2. index.html 파일에 아래의 코드 입력
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Index Page</title>
</head>
<body>
    인덱스 페이지
</body>
</html>
  1. staticpage.html 파일에 아래의 코드 입력
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Static Page</title>
</head>
<body>
    정적 페이지
</body>
</html>

결과

  • 주소창에 http://localhost:8080 을 입력하면 index.html이 출력되는 것을 확인할 수 있음
  • Spring boot에서 index.html은 따로 설정을 안해줘도 기본 url로 배정됨

반응형

↓ 클릭시 이동

복사했습니다!