<p>In my Seam application, I have a Seam component that returns a (<code>@Datamodel</code>) list of items I want to transform into a set of <code>&lt;li&gt;</code> HTML elements. I have this working without a problem. </p>

<p>But now, I want to split up the list according to an EL expression. So the EL expression determines if a new <code>&lt;ul&gt;</code> element should be started. I tried the following:</p>

<pre><code>&lt;s:fragment rendered="#{action.isNewList(index)}"&gt;
  &lt;ul&gt;
&lt;/s:fragment&gt;
&lt;!-- stuff that does the &lt;li&gt;'s goes here --&gt;
&lt;s:fragment rendered="#{action.isNewList(index)}"&gt;
  &lt;/ul&gt;
&lt;/s:fragment&gt;
</code></pre>

<p>But that's invalid, because the nesting for <code>&lt;ul&gt;</code> is wrong.</p>

<p>How should I do this?</p>

I'm not familiar with the Seam Framework, but if I understand the problem correctly something like this might work.
```
```
<!-- before your loop, open your first <ul> if the (@Datamodel) is not empty -->

<s:fragment rendered="#{action.isNewList(index)}">
  </ul>
  <ul>
</s:fragment>
<!-- stuff that does the <li>'s goes here -->

<!-- after your loop, close your last </ul> if the (@Datamodel) is not empty -->
```
```