EJB References Property Editor

Tip Note that this feature might not be included in your version of the IDE. If it is not available, you can edit the deployment descriptor (web.xml) file using the editor of your choice. For more information, see Java Servlet 2.3 Specification available at http://java.sun.com/products/servlet .

You can use the EJB References property editor to specify, edit, and remove EJB references from the web module. You must declare an EJB reference when a component within the web module programmatically looks up an EJB component through JNDI. Examples of components within web modules are a JSP, servlet, JavaBean, or Java class. This declaration indicates to the deployer and the web container that the environment must be able to resolve the JNDI call to an EJB component. Note that each entry corresponds to an <ejb-ref> element in the deployment descriptor.

To display the EJB References property editor:

  1. Click the References tab of the web.xml property sheet.
  2. Click the EJB References value field to make the ellipsis button appear. By default, there are no EJB references.
  3. Then click the ellipsis button to display the property editor.

To add EJB references:

  1. From the EJB References property editor, click the Add button. The Add EJB Reference dialog box appears.
  2. Type the name of the EJB reference in the Reference Name text field. Its value is the name used in the lookup code. By convention, the reference name is located in the ejb subcontext of the bean's environment, although this exact location is not required. By default, ejb/ appears in the text field. Type the EJB reference name, as specified in your lookup code. For example, you might type ejb/CalendarServiceRef.
  3. Type an optional description of the referenced enterprise bean in the Description text field. For instance, type A service that provides calendar management features. You must supply all the values in steps 5 through 7 below. To enter all these values at once, select an EJB in the IDE. All the following values are extracted: type, home interface, and remote interface.
  4. Use the Browse button to select an EJB component within the IDE. This EJB component might have the same name as the EJB reference, but it is not required.
  5. Choose the type of the EJB from the combo box. You can choose between Session and Entity EJB. Your decision depends upon the type of EJB requested. Generally, the EJB has already been coded by the programmer or at least specified by the designer when you are filling out this information. Therefore, you should use the type as specified by the EJB programmer or designer.
  6. Enter the class name of the home interface for the EJB in the Home Interface text field, or press the Browse button to use the Select a Home Interface dialog box to navigate to the location of the desired home interface. A home interface must extend the javax.ejb.EJBHome interface.
  7. Enter the class name of the remote interface for the EJB in the Remote Interface text field. You can also press the Browse button to use the Select a Remote Inteface dialog box. From this dialog box, you can navigate to the location of the desired remote interface. A remote interface must extend the javax.ejb.EJBObject interface. The relationship between the home and remote interfaces is maintained by the EJB itself.
  8. Click OK. The information you have specified is reflected in the EJB References property editor.

To edit EJB references:

  1. From the EJB References property editor, select the desired EJB reference information, and click the Edit button. The Edit EJB References dialog box appears.
  2. Edit the name of the referenced enterprise bean in the Reference Name text field.
  3. Edit the description of the referenced enterprise bean in the Description text field.
  4. Use the Browse button to change the name of the referenced enterprise bean in the Reference Name text field.
  5. Change the type of the EJB from the combo box. You can choose between Session and Entity.
  6. Edit the class name of the home interface for the EJB in the Home Interface text field. You can also press the Browse button to use the Select a Home Interface dialog box. From this dialog box, you can navigate to the location of the desired home interface.
  7. Edit the class name of the remote interface for the EJB in the Remote Interface text field. You can also press the Browse button to use the Select a Remote Interface dialog box. From this dialog box, you can navigate to the location of the desired remote interface.
  8. Click OK. The information you have specified is reflected in appropriate entries the EJB References property editor.

To remove EJB references:

  1. From the EJB References property editor, click the desired EJB reference and the Remove button. The EJB reference is removed from the table.
  2. Click OK to confirm the action or click Cancel to stop the action.
See also
Editing Web Module References Properties

Legal Notices