Hello
I have a web app with ui:repeat and h:dataTable tags. the repeat tag does not work while dataTable works. what did I do wrong in here. see code below
My index.xhtml has the following contens:
= Start ============================
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br/> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"<br/> xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h1>Repeat Tag</h1>
<ul>
<ui:repeat var="color1" value="#{colorsBean.colors}">
<li>#{color1}</li>
</ui:repeat>
</ul>
<hr/>
<h1>DataTable Tag</h1>
<ul>
<h:dataTable var="color2" value="#{colorsBean.colors}">
<h:column>
<f:facet name="header">
<h:outputText value="Color" />
</f:facet>
<h:outputText value="#{color2}"/>
</h:column>
</h:dataTable>
</ul>
</html>
= End ============================
ColorsBean is as follows:
== Start ===========================
public class ColorsBean {
String []colors = new String[] {"White","Black","Freen","Blue","Red","Yellow","Cyan"};
public String[] getColors() {
return colors;
}
public void setColors(String[] colors) {
this.colors = colors;
}
}
= End ============================
the libraries I have under WEB-INF/lib are:
- jsf-api.jar
- jsf-facelets-1.1.11.jar
- jsf-impl.jar
==============================
here is the page output:
Repeat Tag
--------------------------------------------------------------------------------
DataTable Tag
Color
White
Black
Freen
Blue
Red
Yellow
Cyan