//Google AdSense

include Directive(디렉티브)

일부 소스코드를 포함시키는 개념

<%@ include file="/module/top.jsp" %>
<%@ include file="/module/left.jsp" %>

JSP 문법 구조

<%        %> : 자바코드 : scriptlet(스크립트릿)

<%@    %> : 하나의 jsp 설정 : Directive(디렉티브)

<%=      %> : 변수에 담겨있는 값을 출력하는 방법 중 하나 : 표현식

<%!       %> : 메서드 선언부 -> 향후 자바코드로 빠지면 안쓴다

<%--   --%> : 주석 ( Ctrl + Shift + / )

index 레이아웃 전체

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/main.css" />
</head>

<body>

  <!-- Begin Wrapper -->
   <div id="wrapper">
   
         <!-- Begin Header -->
         <div id="header">

		     상단 메뉴	<br/><br/>
<a href="<%= request.getContextPath() %>/user/user_insert_form.jsp">01회원가입</a>
<a href="<%= request.getContextPath() %>/user/user_list.jsp">02회원리스트</a>
<a href="#">03상품등록</a>
<a href="#">04상품리스트</a><br/>

<form action="<%=request.getContextPath()%>/login/login_pro.jsp" method="post">
아이디 : <input type = "text" name = "id">
비 번 : <input type = "text" name = "pw">
<input type ="submit" value = "로그인">
</form>

			   
		 </div>
		 <!-- End Header -->

	<!-- Begin Left Column -->
		 <div id="leftcolumn">

		       왼쪽 메뉴	<br/>
		 
		 </div>
		 <!-- End Left Column -->
		 
  		 <!-- Begin Right Column -->
		 
		 <div id="rightcolumn">
  		       
	          <a href="#">Download this CSS Layout</a>		 
	         
		 </div>
		 <!-- End Right Column -->
		 
		 <!-- Begin Footer -->
		 <div id="footer">

			   하단 메뉴	<br/>	
			  한국스마트정보교육원 063-717-1008 ksmart.or.kr
			    
	     </div>
		 <!-- End Footer -->
		 
   </div>
   <!-- End Wrapper -->

    
</body>
</html>

 

top

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


  <!-- Begin Wrapper -->
   <div id="wrapper">
   
         <!-- Begin Header -->
         <div id="header">
		 /module/top.jsp<br/>
		     상단 메뉴	<br/><br/>
<a href="<%= request.getContextPath() %>/user/user_insert_form.jsp">01회원가입</a>
<a href="<%= request.getContextPath() %>/user/user_list.jsp">02회원리스트</a>
<a href="#">03상품등록</a>
<a href="#">04상품리스트</a><br/>

<form action="<%=request.getContextPath()%>/login/login_pro.jsp" method="post">
아이디 : <input type = "text" name = "id">
비 번 : <input type = "text" name = "pw">
<input type ="submit" value = "로그인">
</form>

			   
		 </div>
		 <!-- End Header -->

 

left

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
		 <!-- Begin Left Column -->
		 <div id="leftcolumn">
		 	/module/left.jsp <br/>
		       왼쪽 메뉴	<br/>
		 
		 </div>
		 <!-- End Left Column -->
		 
  		 <!-- Begin Right Column -->
		 
		 <div id="rightcolumn">
 

 

hadan

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
		 </div>
		 <!-- End Right Column -->
		 
		 <!-- Begin Footer -->
		 <div id="footer">
		      /module/hadan.jsp <br/>
			   하단 메뉴	<br/>	
			  한국스마트정보교육원 063-717-1008 ksmart.or.kr
			    
	     </div>
		 <!-- End Footer -->
		 
   </div>
   <!-- End Wrapper -->

index에 include

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/main.css" />
</head>

<body>

 <%@ include file="/module/top.jsp" %>
 <%@ include file="/module/left.jsp" %>
 		       
	          <a href="#">Download this CSS Layout</a>		 
	          
 <%@ include file="/module/hadan.jsp" %>
    
</body>
</html>

 

 

화면

 

'JSP' 카테고리의 다른 글

[JSP+MySQL] JSP + MySQL / JDBC  (0) 2020.03.19
[JSP] JSP_session응용  (0) 2020.03.13
[JSP] Java와 jsp 연결  (0) 2020.03.12
[JSP] 데이터와 화면 연결하기  (1) 2020.03.12

+ Recent posts