Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to include tiles definition attributes in an inserted page
    primarykey
    data
    text
    <p>I have a tiles-defs.xml that has these definitions...</p> <pre><code>&lt;definition name="masterLayout" path="/WEB-INF/tiles-layouts/globalLayout.jsp"&gt; &lt;put name="pageTemplate" value="over-ride for each page" /&gt; &lt;/definition&gt; &lt;definition name="childLayout" extends="masterLayout"&gt; &lt;put name="pageTemplate" value="/WEB-INF/tiles-layouts/child/layout.jsp" /&gt; &lt;put name="title" value="page title" /&gt; &lt;put name="metaKeywords" value="" /&gt; &lt;put name="metaDescription" value="" /&gt; &lt;put name="body" value="/child/pagebody.jsp"/&gt; &lt;putList name="list"&gt; &lt;add value="title" /&gt; &lt;add value="metaKeywords" /&gt; &lt;add value="metaDescription" /&gt; &lt;add value="body" /&gt; &lt;/putList&gt; &lt;/definition&gt; </code></pre> <p>in globalLayout.jsp I have this working, but I won't always know what attributes the child definition has added to the page.</p> <pre><code>&lt;tiles:insert attribute="pageTemplate"&gt; &lt;tiles:put name="title"&gt;&lt;tiles:getAsString name="title" /&gt;&lt;/tiles:put&gt; &lt;tiles:put name="metaKeywords"&gt;&lt;tiles:getAsString name="metaKeywords" /&gt;&lt;/tiles:put&gt; &lt;tiles:put name="metaDescription"&gt;&lt;tiles:getAsString name="metaDescription" /&gt;&lt;/tiles:put&gt; &lt;tiles:put name="body"&gt;&lt;tiles:getAsString name="body" /&gt;&lt;/tiles:put&gt; </code></pre> <p></p> <p>Since the child definition won't always include the same attributes. Is there a way to use the putList in the child definition to put the attributes into the child page's scope inside of globalLayout.jsp? I've tried the following, but it fails</p> <pre><code>&lt;%@ page import="java.util.Iterator" %&gt; &lt;tiles:importAttribute /&gt; &lt;bean:define id="list" name="list" type="java.util.List" scope="page" /&gt; &lt;tiles:insert attribute="pageTemplate" ignore="true" flush="true"&gt; &lt;% for ( Iterator it = list.iterator(); it.hasNext(); ) { String item = (String) it.next(); %&gt; &lt;tiles:put name="&lt;%=item%&gt;"&gt;&lt;tiles:getAsString name="&lt;%=item%&gt;" ignore="true" /&gt;&lt;/tiles:put&gt; &lt;% } %&gt; &lt;/tiles:insert&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload