Web application development in Java tutorial
When you work in JDeveloper, you organize your work in projects within an application. JDeveloper provides several template applications that you can use when creating an application and projects. The template applications are pre-configured with a basic set of technologies that are needed for developing the various types of applications, and you create your working environment by selecting the template that best fits your needs. You can then configure it to add any other technologies you plan to use.
In the first part of this tutorial you are going to create a new Fusion Web application and build reusable business components that will access the database.
You'll be using the Oracle ADF Business Components technology to map Java objects to existing tables in your database.
If a dialog box opens asking if you would like to import preferences from a previous JDeveloper installation, click NO. Close the Tip of the Day window.
Once loaded, the JDeveloper IDE appears. The very first time you open JDeveloper, the Start Page displays. You can re-invoke the Start Page later by choosing Help > Start Page
Notice the various options available to help you learn about JDeveloper. After exploring some of these options, close the Start Page by clicking the X on its tab (the X appears when you mouse over the tab).
Click the New Application link in the Application Navigator.
In the New Gallery, choose Fusion Web Application (ADF) and click OK.
JDeveloper loads the required features for a Fusion Web application and the Create Fusion Web Application (ADF) wizard launches.
In the Name your application page of the wizard, type HRSystem as the name. If required, you can change the directory path to create your files in another location.
In the Application Package Prefix field set the value to be demo and click Next.
In the Name your project page ensure that the project name is Model (the default). Notice that ADF Business Components and Java are listed as the project features of a Fusion Web application.
The Configure Java settings page allows you to define a default package, a Java source path and an output directory. Click Next to accept the default values.
In the second Name your project page, ensure that the Project Name is ViewController. Scroll through the list of project features to see the types of technologies that can be used with a Fusion Web application.
In the Configure Java settings page accept the defaults and click Finish to create your Fusion Web application and projects.
The HRSystem application and the two projects are displayed in the Application Navigator on the left of the screen.Notice too the Checklist on the right side of the screen.
This checklist is displayed by default when a Fusion Web application is created. It is designed as a guide to lead you through the tasks involved in building this type of application. The next steps show you how the checklist might be used while developing an application.
In the CheckList Overview, click the Connect to a Database step.
The step expands showing useful information such as prerequisites required for performing the task and detailed instructions on how to perform the task. Click the Create a Database Connection button.
Specify the following properties for the new connection you are creating:
Enter the appropriate Oracle JDBC Settings to point to the right host, port and SID for your database. Click the Test Connection button to verify that you can connect successfully.
Click the down arrow to shrink the Connect to a Database step.
In the Checklist, set the status of the Connect to a Database step to Done.
Click the Build Business Services step to expand it, then click the Go to Substeps button.
In the list of substeps, click the Create Entity Objects and Associations substep.
Click the Create Entity Objects and Associations button.
In the Select Project for Action dialog, select the Model project and click OK.
In the Initialize Business Components Project dialog select the HRConn connection if it is not already selected. Click OK.
The Create Business Components from Tables wizard launches. In the Entity Objects page, click the Query button to examine the data dictionary and see available tables.
Select the DEPARTMENTS and EMPLOYEES tables in the Available list, and click the right arrow to move your selections to the Selected list. This step creates updatable entity objects based on the tables selected.
Click Next to continue.
In the Entity-based View Objects page of the wizard, move Departments (HR.DEPARTMENTS) and Employees (HR.EMPLOYEES) to the Selected list. This step creates matching view objects DepartmentsView and EmployeesView for performing queries on the entity objects you just created.