Dev's/Web

[Dev's] Tiles 팝업에는 적용되지 않도록 설정하기

rookas89 2022. 5. 4. 10:33
728x90

app-tiles-definition.xml 에

<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN" "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">

<tiles-definitions>
    <!-- 메뉴 표시 -->
    <definition name="base" template="/WEB-INF/jsp/layout/app_main_layout.jsp">
        <put-attribute name="css" value="/WEB-INF/jsp/layout/tiles/import/app_css.jsp" />
        <put-attribute name="script" value="/WEB-INF/jsp/layout/tiles/import/app_script.jsp" />
        <put-attribute name="header" value="/WEB-INF/jsp/layout/tiles/app_header.jsp" />
        <put-attribute name="left"   value="/WEB-INF/jsp/layout/tiles/app_sidenav.jsp" />
        <put-attribute name="subcon" value="/WEB-INF/jsp/layout/tiles/app_subcontents.jsp" />
        <put-attribute name="footer" value="/WEB-INF/jsp/layout/tiles/app_footer.jsp" />
        <put-attribute name="banner" value="/WEB-INF/jsp/layout/tiles/app_banner.jsp" />
        <put-attribute name="allmenu" value="/WEB-INF/jsp/layout/tiles/app_allmenu.jsp" />
        <put-attribute name="quickmenu" value="/WEB-INF/jsp/layout/tiles/app_quickmenu.jsp" />
    </definition>
    
    <!-- 메뉴 미표시 -->
    <definition name="baseEmpty" template="/WEB-INF/jsp/layout/tiles/templateEmpty.jsp">
    	<put-attribute name="css" value="/WEB-INF/jsp/layout/tiles/import/app_css.jsp" />
        <put-attribute name="script" value="/WEB-INF/jsp/layout/tiles/import/app_script.jsp" />
    </definition>
    
    <definition name="*.part" extends="baseEmpty">
        <put-attribute name="body" value="/WEB-INF/jsp/app/{1}.jsp" />
    </definition>
 
     <definition name="*/*.part" extends="baseEmpty">
         <put-attribute name="body" value="/WEB-INF/jsp/app/{1}/{2}.jsp" />
     </definition>
    
    <definition name="*/*/*.part" extends="baseEmpty">
        <put-attribute name="body" value="/WEB-INF/jsp/app/{1}/{2}/{3}.jsp" />
    </definition>     
 
 	<!-- 메뉴 표시 -->
	<definition name="*/*/*/*" extends="base">
 		 <put-attribute name="main" value="/WEB-INF/jsp/app/{1}/{2}/{3}/{4}.jsp" />
 	</definition> 
 
 
	<definition name="*/*/*" extends="base">
 		 <put-attribute name="main" value="/WEB-INF/jsp/app/{1}/{2}/{3}.jsp" />
 	</definition> 
</tiles-definitions>

 

메뉴표시 / 메뉴 미표시로 분리하고

templateEmpty.jsp 를 해당 경로에 생성

 

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="tiles"  uri="http://tiles.apache.org/tags-tiles"  %>
<%@ taglib prefix="c"      uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt"    uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form"   uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="ui"     uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1, maximum-scal=1, user-scalable=no"/>
    <title>빈화면</title>
    <tiles:insertAttribute name="css" />
   	<tiles:insertAttribute name="script" />
</head>

<body>
    <tiles:insertAttribute name="body" />
</body>

</html>

 

그리고나서 팝업으로 띄울 화면을 호출 할 때,

@RequestMapping(value = "HomePopup.do")

return에 "~Popup.part"; .part를 붙여준다.

그러면 HomePopup.do 를 호출 하였을 시, jsp 경로를 호출하면서, .part가 적용되어

Tiles가 적용되지 않은 화면이 호출된다.

 

728x90