include액션  : include 지시어와 유샇게 다른 페이지를 import함
파라미터 전달 가능 , 실행 시점에 해당 파일을 호출하고 결과 포함시킴



<jsp:param value="test@test.com" name="email"/>: 파라미터로 이메일 네임을 가진 값 전달

<%=request.getParameter("email")%> : 이메일 네임을 가진 파라미터 값 가져오기 

 

[footer.jsp]

1
2
3
4
5
6
7
8
9
10
11
12
13
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<%=request.getParameter("email")%>
<%=request.getParameter("tell")%>
</body>
</html>
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4f; text-decoration:none">Colored by Color Scripter
 

 

[IncludeAction.jsp]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<h2>includeAction에서 footer 호출</h2>
<br>
<h2>includeAction에서 출력하는 메세지 입니다.</h2>
<jsp:include page="footer.jsp">
    <jsp:param value="test@test.com" name="email"/>
    <jsp:param value="010-0000-0000" name="tell"/>
</jsp:include>
</body>
</html>
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4f; text-decoration:none">Colored by Color Scripter
 

'Servlet & JSP' 카테고리의 다른 글

Scope  (0) 2019.06.20
HTTP 응답 상태  (0) 2019.06.20
JSP 예제_include  (0) 2019.06.20
JSP 예제_page  (0) 2019.06.20
JSP 주석  (0) 2019.06.20

+ Recent posts