본문으로 바로가기

[JSP][introduce]

category JSP 2018. 4. 16. 18:52



JSP


introduce get 방식!!


파일 5개만들어 주시면 되겠습니다.

1top.jsp

1bottom.jsp

1left.jsp

1bestiteam.jsp

1newitem.jsp

1teplate.jsp




1.1top.jsp


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<%@ 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>상단에 표시될 메뉴 파일 이름</title>
</head>
<body>
<a href="#">Login</a> | 
<a href="#">Join</a>
</body>
</html>
 
 
cs


2.1bottom.jsp


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<%@ 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>
</head>
<cental>
<body>
    
          since 2018
    
</body>
</cental>
</html>
cs



3.1left.jsp


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<%@ 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>좌측에 표시될 메뉴 파일 이름</title>
</head>
<body>
    <a href="?page=1newitem.jsp">신상품</a>
    <br>
    <br>
    <a href="?page=1bestiteam.jsp">인기상품</a>
</body>
</html>
cs



4.1bestiteam.jsp



1
2
3
4
5
6
7
8
9
10
11
12
13
14
<%@ 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>인기상품 페이지 파일 이름</title>
</head>
<body>
인기상품 목록입니다
</body>
</html>
 
 
cs




5.1newitem.jsp


1
2
3
4
5
6
7
8
9
10
11
12
13
14
<%@ 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>신상품 페이지 파일 이름</title>
</head>
<body>
신상품 목록입니다
</body>
</html>
 
 
cs


6.1teplate.jsp



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<%@ 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>템플릿 페이지</title>
</head>
<body>
    <%
        String newpage = request.getParameter("page");
        /* right.jsp 에서 page값을 넘겨받는다. */
        if (newpage == null) {
            /*여기에쓰는 페이지가 처음 페이지가 열렸을때 보이는 페이지다
            처음 페이지가 열리면 newpage의 값은 null이고  이프문이 사용되면서 메인,jsp가 나온다.
            만약 왼쪽의 새상품을 누르게되면 left.jsp에서 page값이 넘어오면서 newpage의 값이
            누른 메뉴에 맞게 바뀌고 그에때라 인클루드도 실행되서 페이지가 바뀌어 보이게되는것*/
            /* newpage = "newitem.jsp"; */
            newpage = "1newitem.jsp";
        }
    %>
 
    <table border="1" cellpadding="0" cellspacing="0">
        <tr>
            <td colspan="2" height="35"><jsp:include page="1top.jsp" /></td>
        </tr>
        <tr height="100">
            <td align="center" width="100"><jsp:include page="1left.jsp" /></td>
            <td width="500" align="center"><jsp:include page="<%= newpage %>" /></td>
        </tr>
        <tr height="35">
            <td colspan="2" align="center"><jsp:include page="1bottom.jsp" />
            </td>
        </tr>
    </table>
</body>
</html>
 
 
cs





실행결과






'JSP' 카테고리의 다른 글

[JSP][JAVABEAN]  (0) 2018.04.16
[JSP][sendRedirect( )]  (0) 2018.04.14
[JSP][에러 페이지만들기]  (0) 2018.04.14
[JSP][장바구니 만들기]  (0) 2018.04.13
[JSP][jsp, 스코프 예제]  (0) 2018.04.13