title: facelet - nested <ui:insert>
body: <p>I have multiple templates which differs with each other only by few  containers. The most complex one contains superset of all  containers used in all other one thus to avoid creating multiple templates I created the most complex one in following format</p>
  
  <pre><code>&lt;ui:insert name="container1"&gt;
   some layout stuff (div and all)
   &lt;ui:insert name="container1Content"&gt;
   &lt;/ui:insert&gt;&lt;/ui:insert&gt;
  </code></pre>
  
  <p>defining nested insert for each container and content.</p>
  
  <p>Now in client template based on what is needed
  I turn off container which is not needed as </p>
  
  <pre><code>&lt;ui:define name="container1/&gt;
  </code></pre>
  
  <p>else if container is needed, just define content as</p>
  
  <pre><code>&lt;ui:define name="container1Content"&gt;doSomething&lt;/ui:define&gt;
  </code></pre>
  
  <p>Please let me know if you guys see any issues with this approach, any potential problem or alternate approach for similar scenario.</p>
  
  <p>thanks a lot.</p>
  
  <p>Maddy</p>