2

How to get the following result in JSF with

<div id="tagcloud">
    <a href="#" rel="0.1">Lorem</a>
    <a href="#" rel="2">ipsum</a>
    <a href="#" rel="3">dolor</a>
    <a href="#" rel="4">sit</a>
    <a href="#" rel="5">amet,</a>
    <a href="#" rel="6">consectetur</a>
    <a href="#" rel="7">adipisicing</a>
</div>

I tried <t:datatable> or <t:datalist> but both are not able to.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Abhishek Dhote
  • 1,638
  • 10
  • 41
  • 62

2 Answers2

4

Assuming you use Facelets, the following should do it:

<div id="tagcloud">
    <t:dataList value="#{backingBean.items}" var="item" layout="simple">
        <a href="#" rel="#{item.rel}">#{item.name}</a>
    </t:dataList>
</div>

If you're using JSP (hope not), you can replace #{item.name} with an h:outputText.

backingBean.items in the example points to some backing bean that returns a List with the values that differ for each row.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
4

why not use jstl

<c:forEach var="person" items="${people.people}">
        <tr>
          <td>${person.name}</td>
          <td>${person.age}</td>
          <td>${person.height}</td>
        </tr>
      </c:forEach>

or

<ui:repeat value="#{TableBean.perInfoAll}" var="info">
   <li> 
  <h:inputText value="#{info.id}" />
  <h:inputText value="#{info.name}" />
   </li> 
  </ui:repeat>
dov.amir
  • 11,489
  • 7
  • 45
  • 51