강의_7장 액션 태그.pdf
1. 액션 태그의 종류
- jsp:include=>외부 페이지의 내용을 포함
- jsp:forward=>다른 페이지나 사이트로 이동
- jsp:param=>인자를 추가할 때 사용
실습
red.jsp
<%@ 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 bgcolor="red">
<center>
<h3>[ jsp:forward 액션 태그에 대한 예제]</h3>
<hr>
이 파일은 red.jsp입니다.<br>
웹 브라우저에 배경색이 빨간색으로 나타날까요?<br>
노란색으로 나타날까요?<br>
forward 액션 태그가 실행되면 이 페이지의 내용은 출력되지 않습니다.<br>
<jsp:forward page="yellow.jsp"></jsp:forward>
</center>
</body>
</html>
yellow.jsp
<%@ 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 bgcolor="yellow">
<center>
<h3>[forward 액션 태그에 대한 예제]</h3>
<hr>
이 파일은 yellow.jsp입니다.<br>
웹 브라우저에 나타나는 URL과 전혀 상관없는 파일 입니다.
</center>
</body>
</html>

red02.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body bgcolor="red">
<center>
<h3>[ jsp:forward 액션 태그에 대한 예제]</h3>
</center>
<hr>
이 파일은 red02.jsp입니다.
<br> 웹 브라우저에 배경색이 빨간색으로 나타날까요?
<br> 노란색으로 나타날까요?
<br> forward 액션 태그가 실행되면 이 페이지의 내용은 출력되지 않습니다.
<br>
<jsp:forward page="yellow02.jsp">
<jsp:param value="red02.jsp" name="url" />
<jsp:param value="Happy New Year!" name="news" />
</jsp:forward>
</body>
</html>
yellow02.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body bgcolor="yellow">
<center>
<h3>[forward 액션 태그에 대한 예제]</h3>
<hr>
이 파일은 yellow02.jsp입니다.<br>
웹 브라우저에 나타나는 웹페이지는<br>
<%= request.getParameter("url") %>
에서 넘어온 메세지:
<%= request.getParameter("news") %>
</center>
</body>
</html>
