| Author |
Tiles definition xml or JSP
|
Aruna Srinivasan
Greenhorn
Joined: May 10, 2005
Posts: 1
|
|
In our project we have decided to use tiles to control the layout. 2 ways we are contemplating are: 1. Use tiles.xml and provide the definition of the pages there based on template JSP pages or 2. Use a different JSP as a definition for a template. Example: Say I have a template.jsp, such as <div id="level1"> <div id="topBar"> <tiles:insert attribute="header" flush="false"/> </div> <div id="level2"> <tiles:insert attribute="body" flush="false"/> </div> </div> Approach 1 will use a xml definition file as <definition name="layout.example" path="/template.jsp" > <put name="header" value="/common/header.jsp" /> </definition> <definition name="/page1.tiles" extends="layout.example" > <put name="body" value="/page1.jsp" /> </definition> Approach 2 uses a JSP file (page1.jsp) such as <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %> <tiles:insert definition="/template.jsp"> <tiles ut name="header" value="/common/header.jsp"/> <tiles ut name="body" value="/page1.jsp"/> </tiles:insert> I would like to know which of these approaches is preferrable in terms of code maintenance and performance. Thanks, Aruna
|
 |
alan do
Ranch Hand
Joined: Apr 14, 2005
Posts: 354
|
|
|
tiles-def centralizes all your templates definitions declaratively. you can define master templates and simply define areas to instert tiles and reuse the master template. this is the prefer way just as everything is declarative nowadays for simpler maintenance (look at validation and DynaActionForm in struts from v.1.0 to v.1.1).
|
-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
|
 |
 |
|
|
subject: Tiles definition xml or JSP
|
|
|