Tiles
Struts-Config.XML
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
</plug-in>
We need to include the below tiles tag library in the JSP page where we do all the tiles code.
<%@ taglib uri="/WEB-INF/tld/struts/struts-tiles.tld" prefix="tiles"%>
<head>
<title>
<tiles:getAsString name="title" ignore="true" />
</title>
</head>
<body>
<tiles:getAsString name="header" ignore="true" />
Tutorial link:
http://www.allapplabs.com/tiles/create_a_tile_layout.htm
As you can see the title (Key) is given in the above tiles tag and the value (GTEM Request Search Requests) will be fetched from tiles definitions. Same procedure for header as well.
<tiles:insert attribute="body" />
Insert the tiles in the correct regions of the layout using the tiles:insert tag. To insert the SearchRequest JSP, use the tiles:insert tag, which inserts any page or Web resource that the framework refers to as a tile. The tag effectively defines a region in the tile layout. Remember, the objective of the tile layout is to lay out the tiles into the layout.
Tiles-defs.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
<tiles-definitions>
<definition name="simple_layout" path="/uicommon/Menu.jsp">
<put name="title" type="string" value="welcome" />
<put name="header" type="string" value="headerinformation" />
<put name="menu" type="string" value="menu" />
<put name="body" value=""/>
</definition>
<definition name="testPage" extends="simple_layout">
<put name="title" type="string" value="welcome" />
<put name="header" type="string" value="headerinformation" />
<put name="menu" type="string" value="Contact" />
<put name="body" value="/jsp/tiles/jsp/test.jsp"/>
</definition>
<definition name="searchRequestPage" extends="simple_layout">
<put name="title" type="string" value="GTEM Request Search Requests" />
<put name="header" type="string" value="Request : Search Requests" />
<put name="menu" type="string" value="Request" />
<put name="body" value="/jsp/request/jsp/SearchRequest.jsp"/>
</definition>
</tiles-definitions>
Struts-config_Request.xml
<action
path="/app/SearchRequest"
attribute="RequestForm"
name="RequestForm"
scope="request"
validate="false"
type="com.bofa.gcib.gtem.action.request.RequestSearchAction">
<!-- forward name="success" path="/jsp/request/jsp/SearchRequest.jsp"/-->
<forward name="success" path="searchRequestPage"/>
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
</plug-in>
We need to include the below tiles tag library in the JSP page where we do all the tiles code.
<%@ taglib uri="/WEB-INF/tld/struts/struts-tiles.tld" prefix="tiles"%>
<head>
<title>
<tiles:getAsString name="title" ignore="true" />
</title>
</head>
<body>
<tiles:getAsString name="header" ignore="true" />
Tutorial link:
http://www.allapplabs.com/tiles/create_a_tile_layout.htm
As you can see the title (Key) is given in the above tiles tag and the value (GTEM Request Search Requests) will be fetched from tiles definitions. Same procedure for header as well.
<tiles:insert attribute="body" />
Insert the tiles in the correct regions of the layout using the tiles:insert tag. To insert the SearchRequest JSP, use the tiles:insert tag, which inserts any page or Web resource that the framework refers to as a tile. The tag effectively defines a region in the tile layout. Remember, the objective of the tile layout is to lay out the tiles into the layout.
Tiles-defs.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
<tiles-definitions>
<definition name="simple_layout" path="/uicommon/Menu.jsp">
<put name="title" type="string" value="welcome" />
<put name="header" type="string" value="headerinformation" />
<put name="menu" type="string" value="menu" />
<put name="body" value=""/>
</definition>
<definition name="testPage" extends="simple_layout">
<put name="title" type="string" value="welcome" />
<put name="header" type="string" value="headerinformation" />
<put name="menu" type="string" value="Contact" />
<put name="body" value="/jsp/tiles/jsp/test.jsp"/>
</definition>
<definition name="searchRequestPage" extends="simple_layout">
<put name="title" type="string" value="GTEM Request Search Requests" />
<put name="header" type="string" value="Request : Search Requests" />
<put name="menu" type="string" value="Request" />
<put name="body" value="/jsp/request/jsp/SearchRequest.jsp"/>
</definition>
</tiles-definitions>
Struts-config_Request.xml
<action
path="/app/SearchRequest"
attribute="RequestForm"
name="RequestForm"
scope="request"
validate="false"
type="com.bofa.gcib.gtem.action.request.RequestSearchAction">
<!-- forward name="success" path="/jsp/request/jsp/SearchRequest.jsp"/-->
<forward name="success" path="searchRequestPage"/>