13

How to use li and ul tag in JSF Framework?

Hari kanna
  • 2,461
  • 6
  • 29
  • 43

2 Answers2

14

You can use standard html mixed with JSF syntax. Just write

<ul>
<li> Apple </li>
<li> Banana </li>
</ul>

I guess what you want is displaying a list from a List

If you are using Facelets, do:

<ul>
<ui:repeat value="#{myBean.items}" var="item">
<li><h:outputText value="#{item.name}"/></li>
</ui:repeat>
</ul>

If you are not, you should. Anyway, you can do the same with the old JSTL and c:forEach

<html ... xmlns:c="http://java.sun.com/jstl/core">
...
<ul>
<c:forEach items="#{myBean.items}" var="item">
<li><h:outputText value="#{item.name}"/></li>
</c:forEach>
</ul>
pakore
  • 11,395
  • 12
  • 43
  • 62
  • 1
    inside
  • you can use any JSF tag you want.
  • – pakore Jul 13 '10 at 07:42
  • @Hari: `f:verbatim` is only needed if you're using the vintage JSF 1.1. Since JSF 1.2 the view handler has been improved to automatically do that. See also [this answer](http://stackoverflow.com/questions/2844843/is-there-any-problem-when-i-mix-jsf-with-plain-html). – BalusC Jul 13 '10 at 11:22
  • If you're using JSF 1.1 with Facelets, f:verbatim would be optional, too. – Haroldo_OK Apr 16 '13 at 18:21