본문 바로가기
Log/Project

Day56_코드 파일 불러오기

by uxia 2023. 8. 23.

메인페이지를 만드는데, mainpage.jsp 파일에

지난번에 작성한 header.jsp 파일을 붙여넣고

이어서 코드를 작성할 생각이다.

 

근데 파일 갖다붙이는 코드를 까먹어서 다시 찾아봤다.

 


  
<!DOCTYPE html>
<html>
<head>
<!-- head 부분: 스타일시트 링크, 메타 정보 등 -->
</head>
<body>
<%@ include file="header.jsp" %>
<!-- 페이지의 나머지 내용 -->
<h1>Welcome to My Website</h1>
<p>This is the main content of the page.</p>
<!-- footer 등 다른 요소들 -->
</body>
</html>

 

이렇게 하면 파일이 불러와진다.

 

html 파일의 경우 


  
<!DOCTYPE html>
<html>
<head>
<title>Main Page</title>
</head>
<body>
<!-- 헤더 부분 불러오기 -->
<iframe src="header.html" frameborder="0" width="100%" height="100px"></iframe>
<!-- 메인 콘텐츠 -->
<div>
<!-- 메인 페이지 내용 -->
</div>
</body>
</html>

이런 형태로 불러오면 된다.