-
include 디렉티브JSP 2023. 3. 21. 15:38
include 디렉티브
: <jsp:include>액션 태그처럼 지정한 페이지를 현재 위치에 포함시키는 기능을 제공한다.
액션태그는 다른 JSP로 실행 흐름을 이동시켜 실행 결과를 현재 위치에 포함하는 반면에,
include 디렉티브는 다른 파일의 내용을 현재 위치에 삽입한 후에 JSP 파일을 자바로 변환하고 컴파일한다
<%@ include file="포함할파일" %>
- include 디렉티브를 이용하면, java 문법만으로도 다른 JSP 파일과 데이터를 주고받을 수 있다.
마치 sub 파일의 문법을 그대로 가져와서 쓰는 형식이기 때문에, 컨텐츠 타입에도 주의해야한다.
<jsp:include>액션 태그는 레이아웃의 한 구성 요소를 모듈화 하기 위해 사용된다.
반면에 include 디렉티브는 다음 두 가지 목적으로 주로 사용된다.
- 모든 JSP 페이지에서 사용하는 변수 지정
- 저작권 표시와 같이 모든 페이지에서 중복되는 간단한 문장
'JSP' 카테고리의 다른 글
자바빈 , <jsp:useBean> 액션 태그 (0) 2023.03.22 <jsp:forward> 액션 태그 사용법 (0) 2023.03.21 <jsp:param> 페이지에 파라미터 추가 (0) 2023.03.21 <jsp:include> 액션 태그를 이용한 공통 영역 작성 (0) 2023.03.21 에러 처리 ( 익셉션 직접 처리하기 ) (0) 2023.03.21