[OmniFaces utilities] The
createArray()
function creates and returns a dummy object array of the given size. This is useful if you want to iterate n times over an <ui:repeat>
, which doesn't support EL in begin
and end
attributes.Function:
Usage:
Below you
can see a two simple examples of using the of:createArray() function:
// create a
dummy array of size 5
<ui:repeat
value="#{of:createArray(5)}" varStatus="loop">
#{loop.index}#{!loop.last ? ', ' : ''}
</ui:repeat>
Output: Create a
dummy array of size 5: 0, 1, 2, 3, 4
// create another
dummy array of size 5
<table
border="1">
<tr>
<td>Index</td>
<td>First</td>
<td>Last</td>
<td>Begin</td>
<td>End</td>
<td>Step</td>
<td>Current</td>
<td>Even</td>
<td>Odd</td>
</tr>
<ui:repeat
value="#{of:createArray(5)}" varStatus="vs">
<tr>
<td> #{vs.index}</td>
<td>#{vs.first}</td>
<td>#{vs.last}</td>
<td>#{vs.begin}</td>
<td>#{vs.end}</td>
<td>#{vs.step}</td>
<td>#{vs.current}</td>
<td>#{vs.even}</td>
<td>#{vs.odd}</td>
</tr>
</ui:repeat>
</table>
Output:
Niciun comentariu :
Trimiteți un comentariu