String view = "/WEB-INF/views/layout.jsp";
req.setAttribute("includePath", "/WEB-INF/views/index.jsp");
req.getRequestDispatcher(view).forward(req,resp);
req.getRequestDispatcher("btsForm").forward(req,resp);
req.getRequestDispatcher("index.composite").forward(req,resp);
<servlet>
<servlet-name>CompositeDispatcherServlet</servlet-name>
<servlet-class>kr.or.ddit.composite.CompositeDispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CompositeDispatcherServlet</servlet-name>
<url-pattern>*.composite</url-pattern>
</servlet-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="template">/WEB-INF/views/layout.jsp</entry>
<entry key="preScript">/includee/preScript.jsp</entry>
<entry key="topMenu">/includee/topMenu.jsp</entry>
<entry key="leftMenu">/includee/leftMenu.jsp</entry>
<entry key="footer">/includee/footer.jsp</entry>
<entry key="contents">/WEB-INF/views/${logicalView}.jsp</entry>
</properties>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>3.0.8</version>
</dependency>
<!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="parent" template="/WEB-INF/views/template.jsp">
<put-attribute name="preScript" value="/includee/preScript.jsp" />
<put-attribute name="topMenu" value="/includee/topMenu.jsp" />
<put-attribute name="leftMenu" value="/includee/leftMenu.jsp" />
<put-attribute name="footer" value="/includee/footer.jsp" />
</definition>
<definition name="sessionTimer" extends="parent"> <!-- logicalView name과 이 definition name과 연결됨 -->
<put-attribute name="contents" value="/WEB-INF/views/others/sessionTimer.jsp"></put-attribute>
</definition>
</tiles-definitions>
<extends="parent">
속성사용http://tiles.apache.org/dtds/tiles-config_3_0.dtd
) 카피 하여 location에 붙여넣기 - public id에 xml의 아이디(-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN
)카피 - apply and close /**
* Returns a list containing the resources to be parsed. By default, it returns a
* list containing the resource at "/WEB-INF/tiles.xml".
* @param applicationContext The Tiles application context.
* @return The resources.
* @since 2.1.1
*/
protected List<ApplicationResource> getSources(ApplicationContext applicationContext) {
List<ApplicationResource> retValue = new ArrayList<ApplicationResource>(1);
retValue.add(applicationContext.getResource("/WEB-INF/tiles.xml"));
return retValue;
}
tilesdispatchservlet