I'm studying a little bit about Tiles and I had a question. I have the following definition:
<definition name="main" template="/views/templates/main.jsp">
<put-attribute name="titulo" value="##" />
<put-attribute name="header">
<definition template="/views/templates/header.jsp">
<put-attribute name="first" value="/views/menu/first.jsp" />
<put-attribute name="second" value="/views/menu/second.jsp" />
</definition>
</put-attribute>
<put-attribute name="footer" value="/views/templates/footer.jsp" />
</definition>
I am making a template for a crud screen, in which this screen will be composed of 2 panels. One with search fields and one with a results table. But the search form and the results will be different for each screen obviously, so I would like to override the search-fields
and result-table
attributes on pages that extend this setting.
For this I have created the following definition:
<definition name="crud" extends="main">
<put-attribute name="content" >
<definition template="/views/templates/crud-page.jsp">
<put-attribute name="search-fields" value="override" />
<put-attribute name="result-table" value="override" />
</definition>
</put-attribute>
</definition>
Defined this template, I tried to create a page that used this template as follows:
<definition name="crud-users" extends="crud">
<put-attribute name="search-fields" value="/views/crud/usuario/search.jsp" />
<put-attribute name="result-table" value="/views/crud/usuario/result-table.jsp"/>
</definition>
See .jsp files -
main.jsp:
<body>
<tiles:insertAttribute name="header" />
<main>
<tiles:insertAttribute name="content" />
</main>
<tiles:insertAttribute name="footer" />
</body>
crud-page.jsp:
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<tiles:insertAttribute name="search-fields" />
<tiles:insertAttribute name="result-table" />
But what appears on the screen is "override" and not the content of the pages I've overwritten. How to proceed in such cases? What error am I making?