You can use the Data Table from Entity dialog to generate a JSF data table that contains columns for all properties contained in an entity class. In order to make use of this facility, you must already have a JSF managed bean created to handle any back-end data associated with the entity class.
If you use this dialog without having an associated managed bean, you can enter a name for the managed bean in the dialog, and that name will be used in the page regardless of whether it is valid or not. You can then create a managed bean using the IDE's Managed Bean wizard, or if you use the JSF Pages from Entity Classes wizard, managed beans are generated for all selected entity classes.
<html>
tag), as shown below:
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
jsf
' in the editor, press Ctrl-Space,
then select the JSF Data Table from Entity option, or, in the Palette,
click and drag the JSF Data Table from Entity component into the desired
location in the editor and release the mouse button. The JSF Table from
Entity dialog box opens.List
of objects that correspond to the entity bean
you selected in the Entity Bean drop-down.List
of Product
objects would display similarly to the following:
<f:view> <h:form> <h1><h:outputText value="List"/></h1> <h:dataTable value="#{productController.productItems}" var="item"> <h:column> <f:facet name="header"> <h:outputText value="ProductId"/> </f:facet> <h:outputText value="#{item.productId}"/> </h:column> ... [ Other columns added here. ] ... </h:dataTable> </h:form> </f:view>
You can customize the template that specifies the generated code for the JSF Form from Entity dialog. To do so, click the Customize Template link in the dialog, and in the template file make any changes to better suit your work patterns. Save the file. The next time you use the dialog, the changes you made to the template will appear in the generated code.