반응형

 

jstl 다운로드 : https://repo1.maven.org/maven2/jstl/jstl/1.2/

 

Index of /maven2/jstl/jstl/1.2/

 

repo1.maven.org

 

web-inf 폴더의 lib 안에 jstl-1.2 jar 파일을 넣어준다.

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

<%@ page language="JAVA" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>엄마!!미안해!!</title>

</head>

<body>

<jsp:include page="./layout/header.jsp"></jsp:include>

<div id="wrapper">

    <jsp:include page="./layout/left.jsp"></jsp:include>

    <div id="page-wrapper">

        <jsp:include page="content_header.jsp"></jsp:include>

        <div class="page-content">

            <jsp:include page="./freeboard/freeboardForm.jsp"></jsp:include>

        </div>

        <jsp:include page="./layout/footer.jsp"></jsp:include>

    </div>

</div>

</body>

</html>

Colored by Color Scripter

cs

이러한 html 파일을 jstl을 이용해서 코딩해보자!

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

<%@ page language="JAVA" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>엄마!!미안해!!</title>

</head>

<body>

<c:import url="/01/layout/header.jsp"></c:import>

<div id="wrapper">

    <c:import url="/01/layout/left.jsp"></c:import>

    <div id="page-wrapper">

        <c:import url="/01/content_header.jsp"></c:import>

        <div class="page-content">

            <%-- <c:import url="/01/freeboard/freeboardForm.jsp"></c:import> --%>

            <c:import url="${!empty param.contentPage ? param.contentPage : '/01/freeboard/freeboardList.jsp'}"></c:import>

        </div>

        <c:import url="/01/layout/footer.jsp"></c:import>

    </div>

</div>

</body>

</html>

Colored by Color Scripter

cs

 

위의 코드를 보면 <%@ taglib="c" uri="http://java.sun.com/jsp/jstl/core" %> 라는 taglib 디렉티브를 추가하고, 

 

<jsp: include page="~~"> 이부분을 -> <c:import url=""> 의 형식으로 바꾸어주었다.

 

반응형

+ Recent posts