Reputation: 54015
I have a Tiles template where each page provides a title, some stuff to add in the <head>
, stuff to put in some concrete <div>
, and stuff to append to <body>
after everything else.
Most of those things are very small since the page is rendered with JS.
How can I get rid of tiles.xml
or make it more manageable?
I don't want each of the pages to require 3 files:
<definition name="my_page" template="/template.jsp">
<put-attribute name="title" value="My Title" />
<put-attribute name="head" value="/tiles/my-head.jsp" />
<put-attribute name="body" value="/tiles/my-page.jsp" />
<put-attribute name="body-append" value="/tiles/my-append.jsp" />
</definition>
And I don't want to put content of all pages in tiles.xml.
Ideally, it would simply redirect my_page to /my_page.jsp
which would import and fill the template by itself.
I'm talking about a Spring app with TilesView
.
Upvotes: 3
Views: 972
Reputation: 27614
You can use the tiles JSP tags directly in your JSP. You don't have to use definitions if you don't want to.
In your my_page.jsp:
<tiles:insertTemplate template="/template.jsp" flush="true">
<tiles:putAttribute name="title" value="My Title" />
<tiles:putAttribute name="head" value="/tiles/my-head.jsp" />
... etc
</tiles:insertTemplate>
See http://tiles.apache.org/framework/tiles-jsp/tlddoc/index.html
Upvotes: 2