## Using a Built-In Control

WebLogic Workshop provides a set of built-in controls that make it easy to access enterprise resources, such as Enterprise Java Beans (EJBs) and databases, from within your application. The control handles the work of connecting to the enterprise resource for you, so that you can focus on the business logic to make your application work.

Most of the built-in controls are customizable controls. That is, when you add a new one to a project, WebLogic Workshop generates a Java control extension (JCX) file that extends the control. In some cases, such as with the Database control or JMS control, you can customize the control by adding or editing methods defined in the JCX file. Others are customized for you, as with the EJB control, which is customized based on the EJB the control will be accessing.

WebLogic Workshop makes it easy to use a built-in control: click Add from the Data Palette window when working in Design or Flow View, and then select the desired control from the drop-down list. You can create a control file:

- At the same time that you add a built-in control to your project. By default, WebLogic Workshop adds this control file with a .jcx extension to the same folder as the file that is currently open in Design View.
- Separately, and then point to it when adding the built-in control. For example, you can create a new database control file in the current folder by choosing Insert —> Controls —> Database. You are prompted to specify which built-in Java control you wish to extend and the parameters associated with it.

The Control Editor is a graphical tool that enables you to design a control, such as the UsersDBControl database control shown in the following figure.

Control Editor

The following table describes the Control Editor tools shown in the previous figure.

Tools for Designing Controls

Callout # | Use this tool... | For this task...
--- | --- | ---
1 | Application Window | Create, view, and edit control files in your portal application projects. The names of control files end in .jcx.
2 | Design and Source Views | Design your control in this area.
3 | Palette Window | Add methods, callbacks, variables, and so on, by dragging components from the Palette window and dropping them onto the Design View canvas. The options available in the Palette window depend on the type of control you are building.
4 | Property Editor Window | Set properties for the currently selected control component. You can select a control component by clicking on it in the Design View canvas or by selecting its name in the Document Structure window (described below).
5 | Document Structure Window | View a summary of the Java entities that comprise the control (see Figure: Document Structure Window for a Database Control). The summary includes the Java classes, methods and signatures, variables, and inner classes for the control. You can select a Java entity in the Document Structure window by clicking on it. When you select a control method, it is selected in the Design View canvas and you can edit its properties in the Property Editor window. You can double-click on a Java entity to jump to its code location in Source View.

The following figure shows the Document Structure window for a database control.

Document Structure Window for a Database Control

To learn more about adding built-in controls:

- View a Demo, Building a Control, to learn how to build a database control.
- See Tutorial: Java Control in the WebLogic Workshop Help.
- See Using Built-In Java Controls in the WebLogic Workshop Help.