You can use the Form from Entity dialog box to generate a JSF form that contains fields for all properties contained in an entity class. You must already have a JSF managed bean created to handle any user data associated with the form.
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 Form from Entity option, or, in the Palette,
click and drag the JSF Form from Entity component into the desired location
in the editor and release the mouse button. The JSF Form from Entity dialog
box opens.Customer
entity class containing a customerId
property is displayed in the following format:
<f:view> <h:form> <h1><h:outputText value="Create/Edit"/></h1> <h:panelGrid columns="2"> <h:outputLabel value="CustomerId:" for="customerId" /> <h:inputText id="customerId" value="#{customerController.selected.customerId}" title="CustomerId" required="true" requiredMessage="The CustomerId field is required."/> ... [ Other fields added here. ] ... </h:panelGrid> </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.