새소식

인기 검색어

풀스택개발자_대학교 정규과정/JSP_Example

jsp:include 예제

  • -

 

 

mainArea.jsp

<%--
  Created by IntelliJ IDEA.
  User: smreo
  Date: 2022-09-16
  Time: 오후 3:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>

</head>
<%
    String includePath = request.getParameter("includePath");
    if (includePath == null) {
        includePath = "popularList"+".jsp";
    }else {
        includePath +=".jsp";
    }
%>
<style>
    @keyframes big {
        from {
            width: 0px;
            height: 0px;
        }
        to {
            width: 170px;
            height: 170px;
        }
    }
    * {
        box-sizing: border-box;
    }

    img {
        animation-name: big;
        animation-duration: 4s;
        animation-timing-function: linear;
        animation-delay: 0s;
    }

    table {
        text-align: center;
        margin-left: 20%;
    }

    table, td, tr {
        width: 1000px;
        border: 1px solid black;
    }

    #mainArea {
        height: 200px;
    }
</style>
<body>
<table>
    <tr>
        <td colspan="2">
            <jsp:include page="top.jsp"/>
        </td>
    </tr>
    <tr id="mainArea">
        <td style="width: 30%">
            <jsp:include page="LeftAside.jsp"/>
        </td>
        <td>
            <jsp:include page="<%=includePath%>"/>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <jsp:include page="bottom.jsp"/>
        </td>
    </tr>
</table>
</body>
</html>

top.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<a href="#">Login</a> | <a href="#">Join</a>
</body>
</html>

LeftAside.jsp

<html>
<head>
    <title>Title</title>
</head>
<body>
<a href="/TestRoot/mainArea.jsp?includePath=newList.jsp">신상품</a>
<a href="/TestRoot/mainArea.jsp?includePath=popularList.jsp">인기상품</a>
</body>
</html>

popularList.jsp

<html>
<head>
    <title>Title</title>
</head>
<body>
<div>
    <p>인기 아이템 입니다</p>
    <img src="https://img.danawa.com/images/mobile/MDNW/mainContent/200/20094.jpg?ver=20220914145352&shrink=170:170">
    <img src="https://img.danawa.com/images/mobile/MDNW/mainContent/201/20105.jpg?ver=20220914170903&shrink=170:170">
    <img src="https://img.danawa.com/images/mobile/MDNW/mainContent/200/20078.jpg?ver=20220914090201&shrink=170:170">
</div>
</body>
</html>

newList.jsp

<html>
<head>
    <title>Title</title>
</head>
<body>
<p>신상 아이템 입니다</p>
<img src="https://img.danawa.com/images/mobile/MDNW/mainContent/200/20054.jpg?ver=20220913134930&shrink=170:170">
<img src="https://img.danawa.com/images/mobile/MDNW/mainContent/200/20085.jpg?ver=20220914095521&shrink=170:170">
<img src="https://img.danawa.com/images/mobile/MDNW/mainContent/200/20041.jpg?ver=20220913074534&shrink=170:170">
</body>
</html>

bottom.jsp

<html>
<head>
    <title>Title</title>
</head>
<body>
<p>Since 2022 sunmoon</p>
</body>
</html>
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.