include된 페이지가 본 페이지에 포함되어 모두 출력되는 include와는 다르게 forward 된 페이지만 출력됨
<!-- forwardTag1_1.jsp -->
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
</head>
<body>
<h1>Forward Tag Example1</h1> <!-- 나타나지 X -->
Forward Tag의 포워딩 전의 페이지입니다. <!-- 나타나지 X -->
<jsp:include page="forwardTag1_2.jsp" />
</body>
</html>
<!-- forwardTag1_2.jsp -->
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<h1>Forward Tag Example1</h1>
당신의 아이디는 <%=id %> 입니다.
당신의 비밀번호는 <%=pwd %> 입니다.
</body>
</html>
<!-- 결과 -->
Forward Tag Example1
당신의 아이디는 abc 입니다. 당신의 비밀번호는 123 입니다.
★ request.sendRedirect("~~.jsp"))는 지정한 주소로 URL이 바뀌지만 forward는 바뀌지 않는다.
'Web > JSP&Servlet' 카테고리의 다른 글
파일 업로드 (0) | 2020.08.07 |
---|---|
에러페이지 (0) | 2020.08.07 |
[JSP] include 액션태그와 지시어 (0) | 2020.08.03 |
MVC 패턴 (0) | 2020.08.02 |
자바 빈(Bean) (0) | 2020.08.01 |