WEB/JSP

[JSP] ch03-07. Include3

밍글링글링 2017. 11. 14.
728x90

3-7. Include3

 

includeMain.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<a href="directiveOut.jsp?userId=blueid">directive</a>
<a href="actionOut.jsp?userId=blueid">action</a>


<%-- 
    forward or redirect는 A페이지에서 B페이지로 넘어가지만.
    include는 A페이지에서 B페이지를 갔다가 다시 A페이지로 넘어온다.
    request 클라이언트에서 서버로 보낼 데이터
    response 서버에서 클라이언트를 보낼 데이터
--%>
 
 

includeMsg.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%= request.getParameter("userId")%>
Colored

 

actionOut.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:include page="includeMsg.jsp"/>님 환영합니다.

 

directiveOut.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="includeMsg.jsp"%>님 환영합니다.
728x90

'WEB > JSP' 카테고리의 다른 글

[JSP] ch04-02. 장바구니  (0) 2017.11.15
[JSP] ch04-01. Cookie  (0) 2017.11.15
[JSP] ch03-06. Scope  (0) 2017.11.14
[JSP] ch03-05. Forward Login  (0) 2017.11.13
[JSP] ch03-04. Redirect Login  (0) 2017.11.13

댓글