You can use custom controls to enclose business logic in a way that exposes a simple interface to developers. Java controls can provide ideal places for code that is used by several parts of a project, removing the necessity to duplicate code.
You can create a Java control for use within the same project as the code using it; for more information, see How Do I: Create and Use a Java Control Within an Existing Project? You can also develop your control code in a control project; see How Do I: Create and Use a Java Control Within a Control Project?
For an introduction to Java controls, see Tutorial: Java Control.
To Create Source Files for a Java Control
It may be a good idea to create a folder specifically for your control. This will help to keep your project structure more intuitive if you begin adding files that your new control requires, such as JCX files for nested controls. The folder you create will be part of the control's package name. Note that you cannot create the control in the root of a project — it must be in a subfolder.
The JCS file will contain your control's implementation class, which is why it requires an "Impl" ending. Note that WebLogic Workshop will preserve the extension as you type.
WebLogic Workshop creates the JCS file and displays it in Design View. It also creates a JAVA file without the "Impl" ending for your control's public interface. As you build your control, you work in the JCS file, adding code for the control's logic. As you do, WebLogic Workshop updates the JAVA file code to reflect changes to the control's public interface. In other words, you never have to edit the JAVA file manually.
With your new control, you can:
For samples of Java controls whose source is kept locally with the source code from which the control is used, see the WebService project in the SamplesApp installed with WebLogic Workshop. For samples of controls in their own control project, see the ControlProject provided with the same application.