quilt code

[웹프로그래밍] 03 디렉티브 태그 본문

daily/웹프로그래밍

[웹프로그래밍] 03 디렉티브 태그

김뱅쇼 2023. 3. 20. 21:45

1. 디렉티브 태그의 세가지 유형


page: JSP 페이지에 대한 정보 설정  <%@ page %>
include: JSP 페이지의 특정 영역에 다른 문서 포함  <%@ include %>
taglib: JSP 페이지에서 사용할 태그 라이브러리 설정 <% taglib %>

 


2. JSP 페이지가 사용할 자바 클래스를 설정하기 위한 page 디렉티브 태그의 속성은?


import

 


3. JSP 페이지의 특정 영역에 외부 파일의 내용을 포함하는 디렉티브 태그


include
<@ inlclude file = "파일명" >

 


4. page 디렉티브 태그를 이용하여 다음 조건에 맞게 어쩌구



1
2
3
4
5
6
7
8
9
10
11
12
13
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>page directives tag</title>
</head>
<body>
    <%@ page import="java.util.Date, java.lang.Math" %>
    현재 날짜: <%=new Date() %>
    <br>
    5의 제곱 : <% out.println(Math.pow(5,2)); %>
</body>
</html>
cs



 

 


5. include 디렉티브 태그를 이용하여 ~

1) header.jsp
1
2
3
4
5
6
7
8
9
10
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>Directives Tag</title>
</head>
<body>
    <h4>Hello, Java Server Pages.</h4>
</body>
</html>
cs

2) include.jsp
1
2
3
4
5
6
7
8
9
10
11
12
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>dt - include</title>
</head>
<body>
    <%@ include file="header.jsp" %>
    현재 시간 : <%= java.util.Calendar.getInstance().getTime() %>
 
</body>
</html>
cs






6.  taglib 디렉티브 태그를 이용하여~

 

'daily > 웹프로그래밍' 카테고리의 다른 글

[JSP] 07 파일 업로드  (0) 2023.03.29
[JSP] 06 폼 태그  (0) 2023.03.27
[JSP] 05장 내장 객체  (0) 2023.03.23
[웹프로그래밍] 02 스크립트 태그 homework  (0) 2023.03.16
[웹프로그래밍] 01 JSP 개요 homework  (0) 2023.03.15