Tuesday, 15 February 2011

java - How to get in JSF datatable` -



java - How to get <th> in JSF datatable` -

please help me... want jsf datable rendered follows i.e employee name in tag in every row.

<table> <thead><tr> <th>name</th> <th>salary</th> </tr></thead> <tbody> <tr class="employeetableoddrow"> <th>john</th> <td>2000.0</td> </tr> <tr> <th>robert</th> <td>3000.0</td> </tr> </table>

but getting follows. name coming in tag not in tag. have tried many combinations couldn't it

<table> <thead><tr> <th>name</th> <th>salary</th> </tr></thead> <tbody> <tr class="employeetableoddrow"> <td>john</td> <td>2000.0</td> </tr> <tr> <td>robert</td> <td>3000.0</td> </tr> </table>

code written follows

<h:datatable value="#{userdata.employees}" var="employee"> <h:column> <f:facet name="header">name</f:facet> #{employee.name} </h:column> <h:column> <f:facet name="header">salary</f:facet> #{employee.salary} </h:column> </h:datatable>

please allow me know how this

<h:datatable value="#{userdata.employees}" var="employee"> <h:column> <f:facet name="header"> <h:outputtext value="name" /> </f:facet> <h:outputtext value="#{employee.name}" /> </h:column> </h:datatable>

example here

java jsf

No comments:

Post a Comment