19.05.15 jsp 쇼핑몰-Center, RentcarMain (동영상 58강)

Back-End/JSP 2019. 5. 15. 10:24
728x90
반응형


Center.jsp, RentcarMain.jsp 페이지 만들기




Center.jsp (중간부분에 출력될 페이지)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<%@ 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">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
    <center>
        <table width="1000">
            <tr height="600"<!-- 센터에 출력될 이미지를 추가 -->
                <td align="center"><img alt="" src="img/Main.png" height="470"
                    width="1000"></td>
            </tr>
        </table>
    </center>
</body>
</html>
cs



RentcarMain.jsp (Top, Center, Bottom을 취합할 메인 페이지)

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=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
 
    <%
        String center = request.getParameter("Center");
        //처음 실행시에는 center 값이 넘어오지 않기에 반드시  null처리를 해야한다.
        //처리를 하지않으면 에러가 발생될수 있다.
        if (center == null) {
            center = "Center.jsp"//디폴트 center값을 부여(첫 화면에는 center이 뜨도록 한다는 말)    
        }
    %>
    <center>
        <table width="1000">
 
            <!-- Top 부분 -->
            <tr height="140" align="center">
                <!-- include page를 사용하여서 main페이지에서 각 페이지가 호출될수 있도록 한다. -->
                <td align="center" width="1000"><jsp:include page="Top.jsp" /></td>
            </tr>
 
            <!-- Center 부분 -->
            <tr align="center">
                <!-- Top랑,Bottom은 화면이 넘어가더라도 바뀌지 않지만 center은 계속 바뀌기 때문에 center값을 준다 -->
                <td align="center" width="1000"><jsp:include
                        page="<%=center%>" /></td>
            </tr>
 
            <!-- Bottom 부분 -->
            <tr height="140" align="center">
                <td align="center" width="1000"><jsp:include page="Bottom.jsp" /></td>
            </tr>
 
        </table>
    </center>
</body>
</html>
cs



728x90
반응형
: