I am trying to create the world most simple dataTable using JSF tomahawk like this:
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:t="http://myfaces.apache.org/tomahawk">
<h:head>
<title></title>
</h:head>
<h:body>
<h:form id="theForm">
<h:outputText value="#{theBean.theList eq null}"/>
<t:dataTable id="dt1" value="#{theBean.theList}" var="item">
<t:column>
<f:facet name="header">
<t:outputText value="Header A"/>
</f:facet>
<t:outputText value="#{item.itemA}"/>
</t:column>
</t:dataTable>
</h:form>
</h:body>
</html>
The above code was save as XHTML file. The bean class is look like this:
@ManagedBean(name="theBean")
@SessionScoped
public class MyBean {
private MyData[] theList = new MyData[] {
new MyData("1111", "", "", "")};
public MyData[] getTheList() {
return theList;
}
public void setTheList(MyData[] theList) {
this.theList = theList;
}
}
public class MyData {
private String itemA;
...
...
}
In the output of the screen I don't see a data table, I see a black color false
word and white blank screen, this is due to this code <h:outputText value="#{theBean.theList eq null}"/>
telling me that the list is not empty.
I see this from the output from the web browser source:
<t:dataTable id="dt1" value="[Lcom.foo.MyData;@1798a6c" var="item">
<t:column>
<t:outputText value=""></t:outputText>
</t:column>
</t:dataTable>
I am just curious to know why the data table doesn't show? How to make it show on the screen?
Sorry for my bad. I didn't include tomahawk jar and other dependencies as well in my classpath. Once I have them inside my classpath, the dataTable
is rendered on the web page. And I notice that, the warning on the tomahawk line located on top of the page has been gone.
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:t="http://myfaces.apache.org/tomahawk">