title: Dynamically composing pages using tiles
body: <p>I'm a new tiles user and love it so far. But I face a problem now and I'm not sure that tiles is the right tool in my hand to achieve my aims.</p>
  
  <p>What I would like to do is to create a general registration form, shared between several sites.
  This registration form will be slightly different on each sites. So clearly they could use the same jsp files and java codes. My aim is to have a .properties files in which I can configure which input form fragments should be included in the form and which should not (for each sites).</p>
  
  <p>Is there any way to dynamically insert attributes? </p>
  
  <p>I have created a view preparer class. This way I can add/override existing attributes.</p>
  
  <pre><code>public class TestViewPreparer extends ViewPreparerSupport {
      public void execute(TilesRequestContext tilesContext, AttributeContext attributeContext) throws PreparerException {
          Attribute attribute = new Attribute("/WEB-INF/views/search-panel/holiday-type.jsp");
          attributeContext.putAttribute("rfFragment", attribute);
      }
  }
  </code></pre>
  
  <p>But this only add/override one attribute at time. Besides in the template file I have to add the following line for each of them.</p>
  
  <pre><code>&lt;tiles:insertAttribute name="rfFragment1" /&gt;
  &lt;tiles:insertAttribute name="rfFragment2" /&gt;
      //... etc
  </code></pre>
  
  <p>What I'm looking for is more like adding a list of <code>Attribute</code>s and include them in the template line with a  loop. Somehow like this:</p>
  
  <pre><code>    &lt;tiles:useAttribute id="fragments" name="rfFragments" classname="java.util.List" /&gt;
      &lt;c:forEach var="fragment" items="${fragments}"&gt;
          &lt;tiles:insertAttribute value="${fragment}" flush="true" /&gt;&lt;/c:forEach&gt;
  </code></pre>
  
  <p>My problem is that <code>AttributeContext</code> can take only one Attribute and cannot a List of Attributes. Or Did I miss something?</p>
  
  <p>I hope I described my problem enough , given the details.</p>