JSP/ACTION.BEAN

chapter01 : include 1 / include 2

GAWON 2023. 5. 23. 19:15
<%@ 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>
	<h1>include1.jsp 페이지</h1>
	
	<br><hr><br>
	
	<%-- Ex01_include1.jsp 페이지에 Ex01_include2.jsp페이지를 포함 --%>
	
	<%--1. include 지시어 --%>
	<%@ include file="Ex01_include2.jsp" %>

	<%-- 2.include 액션 태그 --%>
	<jsp:include page="Ex01_include2.jsp">
		<jsp:param name="name" value="김씨"/>
		<jsp:param name="age" value="20"/>
		<jsp:param name="addr" value="서울"/>
	</jsp:include>
	
	
</body>
</html>
 <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("utf-8");
	String name = request.getParameter("name");
	String age = request.getParameter("age");
	String addr = request.getParameter("addr");
%>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h1>include2.jsp페이지</h1>
	<div>
		이름 : <%=name %>
		나이 : <%=age %>
		주소 : <%=addr %>
	</div>

</body>
</html>