views:

194

answers:

1

Hi! I have problem with h:datatable tag in JSF. I don't know, why my datatable is not showing on my page. Some advices?

Here is my code:

<h:dataTable  rows="2" var="deb" value="#{debCredTab.rows}">
                    <h:column>
                        <f:facet name="header">
                            Debet
                        </f:facet>
                        <h:inputText value="#{deb.debet}" />
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Credit
                        </f:facet>
                        <h:inputText value="#{deb.credit}" />
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            DebCredSum
                        </f:facet>
                        <h:inputText value="#{deb.debetCreditSum}" />
                    </h:column>
                </h:dataTable>

And here is my output:

<table rules="all">
  <tbody>
  </tbody>
</table>

The question is: why? I forgot something? Why my table is not showing on the page?

+2  A: 

I would test to make sure your rows is not returning null:

<h:outputText value="#{debCredTab.rows eq null}" />

I would then check to see if the number of rows is zero.

McDowell
Actually they are, but, as far as i understood, i can collect info from datatable, not only insert. Is it correct?
Yurish
eh? you can collect data if you have inputs. and you don't have.
Bozho
You will need an empty row to add data to. See this answer for an example: http://stackoverflow.com/questions/355614/datatable-containing-inputtext-is-it-possible-with-jsf-custom-component/356740#356740
McDowell
Thanks McDowell! Your post helped me!
Yurish