# How Do I: Use an Enterprise JavaBean in a Web Application?

If you want to use a session (or entity) bean from a web service or page flow, you can use the standard J2EE approach to locate and reference the bean, that is, by obtaining a reference through jndiContext. Alternatively, in WebLogic Workshop you can use an EJB Control. The current topic provides pointers on how to create and use an EJB control:

- To create an EJB control, you must first build and deploy the EJB, and then create an EJB Control for this bean. For a detailed description of these steps, see How Do I: Test an Enterprise JavaBean?
- If the EJB control is only going to be used within one web (service) project, you can create the control within that project (in a separate subfolder). However, if the EJB control is going to be used in multiple projects, consider using a control project. Control projects can be build and packaged in a JAR, and can subsequently be accessed by all projects in the application, and even be imported from other applications. For more information, see How Do I: Create and Use a Java Control Within a Control Project?
- You can use the EJB control in the web service or in the page flow, specifically in the page flow controller (JPF) file, for instance by dragging-and-dropping the control in the target Design View. For more information, see Getting Started with Java Controls.

## Samples

Java Control Samples

callJavaControlController Sample

Related Topics

Guide to Building Page Flows

Getting Started with Web Services