This topic will familiarize you with the basic concepts of Java control design and development.
Java controls are reusable components that are optimized to access enterprise resources and execute business tasks. In this tutorial you will see how to use custom controls and one type of built-in control called the database control. Other built-in controls are discussed in the advanced Tutorial: Java Control. For an overview of Java controls, see Working with Java Controls.
A database control makes it easy to access a relational database. A database control method is associated with an SQL query against a database. When a database method is invoked, the corresponding SQL query is executed to retrieve data, perform operations like inserts and updates, and even make structural changes to the database. In this tutorial you will define methods for all these operations, that is, you will create methods to create a database table, insert a new record, update an existing record, and read a record. The database control automatically handles the work of connecting to the database, so you don’t have to understand JDBC to work with a database.
Custom controls model business logic and are often an intermediary between your client application, such as a web application, and built-in controls. For instance, a Purchase custom control might take an 'add to shopping cart' request for a particular product through a web page, use a database control to query whether this product is still in stock, and return a response to the web application that the product is not available, is backordered, or is available and has been successfully added to the cart.
Java controls are developed using WebLogic Workshop, a visual tool for designing J2EE applications. The image below shows the finished tutorial.
The Application tab (area 1) shows the application's source files. A custom control is stored in two files, that is a .jcs and a .java file. When you define a custom control, you only work in the .jcs file; WebLogic Workshop automatically synchronizes the associated .java file. A database control, like most built-in controls, is stored in a file with a .jcx extension.
The main work area (area 2) shows the Design or Source View of the components you are building, in this case the Design View of a custom control.
The Property Editor (area 3) allows you to see and set properties of the Java control under development.
A Java control project folder contains Java controls that are developed for reuse throughout the application as well as in other applications. A Java control project is like an organizational unit; when building controls you build all the Java controls in a project and the resulting files are wrapped in a single JAR file with the same name as the project. You can have one or multiple control projects in an application. In this tutorial you will develop all Java controls using one Java control project folder called MyControlProject (area 4). It is also possible to develop a Java control directly in a web or web service project; in that case the Java controls are meant to be used only in the web or web service project and not throughout the application or across applications.
Other components of the application are built in other projects. In this tutorial you will build a test web service, which you will use as a client application to test the controls. Web services are created in a web service project folder, called MyControlTestProject in this tutorial (area 5).
Click the arrow to navigate to the next step.