JSP

액션 태그 실습

jackypark 2022. 9. 16. 16:42

처음해보는 include 액션 태그라 접근이 어려웠다.. 결국 하긴했지만 아직 까지 이해가 잘안된다.. 이번 주말동안 include 액션태그에 대해서 공부를 해야겠다..

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>JSP - Hello World</title>
</head>
<body>
<%
    String pro=request.getParameter("pro");
    if(pro==null){
        pro="Product"+".jsp";
    }else{
        pro+=".jsp";
    }

%>


<table border="1" align="center">
    <tr>
        <td COLSPAN="2">
            <%@include file="Header.jsp"%>
        </td>
    </tr>
    <tr>
        <td>
         <jsp:include page="0916Ex.jsp"/>
        </td>
        <td>
            <jsp:include page="<%=pro%>"/>
        </td>
    </tr>
    <tr>
        <td COLSPAN="2">
            <%@include file="footer.jsp"%>
        </td>
    </tr>
</table>

</body>
</html>

 

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
    String pro=request.getParameter("pro");
%>
<html>
<head>
    <title>Title</title>
</head>
<body>
<!-- hihi 이주석은 개발자도구에서 보임-->
<a href="?pro=Product">신상품</a>
<br>
<br>
<a href="?pro=popProduct">인기상품</a>

<%-- jsp...--%>
</body>
</html>