Creating Managed Beans

See Also

You can create JSF managed beans for your application using the IDE's Managed Bean wizard. In JSF 2.0, any metadata that you specify in the wizard is translated into annotations that are applied to the managed bean once it is generated. If you prefer to register the managed bean with the application using a Faces configuration file (faces-config.xml) instead, the wizard provides the option of doing so.

To create a new JSF managed bean:

  1. In the Projects window, right-click your project node and choose New > JSF Managed Bean. The JSF Managed Bean wizard opens.

    (If JSF Managed Bean is not listed, choose Other. Then select the JavaServer Faces category and JSF Managed Bean file type. Click Next.)
  2. In the Class Name field, type in a name for the managed bean.
  3. In Location, specify the top-level location for the file. ('Source Packages' is the default option, and places the file in the project's src/java folder.
  4. In Package, specify a package name for the new class. If you specify the name of a package that does not exist, it will be created upon completing the wizard. The Created File field provides a read-only path to the new location for the file.
  5. (Optional.) If you want to to register the managed bean with the application using a Faces configuration file, select the 'Add data to configuration file' option. Doing so will prevent the wizard from generating annotations in the new class. If a faces-config.xml does not yet exist for the application, one will be created upon completing the wizard.
  6. (Optional.) Specify configuration details:
  7. Click Finish. The new managed bean is generated and opens in the editor.
See Also
Creating JSF Pages
Editing JSF Pages
Creating a New Application with JSF Support
About JavaServer Faces Framework Support

Legal Notices