2011/4/4 Sameera Gayan <[email protected]> > First of all, pardon me if I'm asking a wrong question here.. new to the > mailing list >
It's correct :-) > > I have the following tiles configuration file > > > > <tiles-definitions> > <definition name="base" template="/includes/layout.jsp"> > <put-attribute name="header" value="/includes/header.jsp" /> > <put-attribute name="menu" value="/includes/menu.jsp" /> > <put-attribute name="footer" value="/includes/footer.jsp" /> > </definition> > <definition name="home" extends="base"> > <put-attribute name="contentBody" value="/home/view.jsp" /> > </definition> > </tiles-definitions> > and to display "view.jsp" page I have another page called "home.jsp" and it > has the following code (only) > > //home.jsp > > <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %> > <tiles:insertDefinition name="home" /> > and the problem here is, If i want to load "edit.jsp" page with same > layout, > I need to repeat this part in tiles.xml > > <definition name="editbase" extends="base"> > <put-attribute name="contentBody" value="/home/edit.jsp" /> > </definition> > and create a file called "editbase.jsp" and call it. (repeating the above > code) > > I'm just wondering is this the correct way or can I do something like > > <tiles-definitions> > <definition name="base" template="/includes/layout.jsp"> > <put-attribute name="header" value="/includes/header.jsp" /> > <put-attribute name="menu" value="/includes/menu.jsp" /> > <put-attribute name="footer" value="/includes/footer.jsp" /> > </definition> > <definition name="home" extends="base"> > <put-attribute name="contentBody" value="/home/view.jsp" /> > <put-attribute name="contentBody" value="/home/edit.jsp" /> > </definition> > </tiles-definitions> > and load the page accordingly.. I think my question is clear > You cannot put two attribute values to one attribute. Never tried, but I think the last one wins. So the first part of your code works. Correct if I am wrong, but do you want a website that has the same layout everywhere, with the exception of "contentBody" part? If yes you might be interested in TilesDecorationFilter: http://tiles.apache.org/framework/tutorial/advanced/utils.html <http://tiles.apache.org/framework/tutorial/advanced/utils.html>Antonio
