This chapter from BEA WebLogic Workshop 8.1 (Kick Start series, from Sams Publishers, by Albert J. Saganich, Jr., et al., 2004. ISBN: 0-672-32622-1) explores the WebLogic Workshop programming model and introduces enterprise application development.
WebLogic Workshop Application Development Basics - Creating Simple Rowset Controls (Page 7 of 7 )
Rowset controls are the heart of any database application. There are, in fact, two types of database access controls. Database controls, which are similar to rowset controls, require all data access to be coded by hand. Rowset controls go a step further than database controls, in that they provide a core set of access methods, based on java.sql.RowSets, for accessing data. Developers are free to add functionality, but a set of core methods are supplied.
To create a rowset control, select a folder where the control will be created and follow these steps:
Select File, New, Other File Types from the Workshop menu (see Figure 3.13).
(Same as step A.)
Select Business Logic in the left pane.
Select RowSet Control in the right pane (see Figure 13), and click Create.
Figure 13 - Creating a rowset control.
Enter the control variable name.
Select an appropriate datasource.
Select the methods to create, either Query and Update a Database Table (for traditional tables) or Query a View or Table (no update methods generated). The remainder of the steps for adding a rowset control are shown in Figure 14.
Figure 14 - Selecting methods, columns, and a primary key source in the RowSet Control Wizard.
Select the schema and table name, and click Next.
Select the columns to include, and click Next.
Select the primary key mechanism, and click Create.
When you're finished, a new rowset control is created in the folder you selected. The new control can be used to access the table from a Page Flow or another control.
Deploying and Configuring Applications
To this point, you've been working with applications without understanding how they can be built or deployed. Whenever you make a change to an application, WebLogic Workshop automatically synchronizes with the running instance of WebLogic Workshop.
Before an application can be run, it must be compiled. WebLogic Workshop can build application components automatically or on demand. In the Workshop environment, building an application is more then just compilation. Because applications contain annotations, these annotations must be reviewed, the components compiled, supporting classes created and configured, and more. WebLogic Workshop applications can be in development or production modes. In development mode, all components are compiled automatically as they change. In production mode, applications or components must be built using the command-line wlwbuild.cmd scripts or Workshop's Build, Application, Build, EAR or Build, Project, projectname menus. You can change an application's or project's properties by selecting the application or project, right-clicking, and then choosing Properties. Figure 15 shows the Application Properties dialog box.
Figure 15 - The Application Properties dialog box for the chapter3 application.
Mapping Applications and Projects to Directories
WebLogic Workshop maps directly to an EAR file. Figure 3.16 shows the directory structure of the chapter3 sample Workshop Web application. Table 3.1 maps WebLogic Workshop folders to the directories on disk.
Figure 3.16 - Application directory structure.
Table 3.1 Directory to Application Mapping
Directory or File
Workshop Application Equivalent and Contents
Workshop application configuration file. Do not edit or delete this file.
Files and classes generated by Workshop. Not displayed.
Location for all project JARs. Maps to Application\lib. Any JAR files added to this directory are added to the application's class path. Schema and other projects that produce JAR files place them here.
Actual application contents. Maps to chapter3\chapter3Web\.
Maps to chapter3\chapter3web\WEB-INF. All tag libraries and Web application deployment descriptors are located here.
Schema project. Maps to chapter3\Schemas.
Maps to chapter3\modules. Contains all application-level deployment descriptors managed by WebLogic Workshop.
In this chapter, you learned that
Workshop supports the creation of several application types, including Web applications, Schema, portals, and business processes.
The WebLogic Workshop programming model is the underlying basis for all Workshop applications. Its constituent parts (Page Flow, controls, and so on) are based on Struts and the MVC pattern and are used to model application functionality.
Applications and projects are the heart of WebLogic Workshop development. Projects are used to contain Page Flows, controls, and other components of an application and map directly to EAR format on disk.
One of the most common types of controls is the rowset control, which can be used to add data, query for data, traverse rows of data, and delete data.
This chapter is from BEA WebLogic Workshop 8.1, by Albert J. Saganich, Jr., et al. (Apress, 2004, ISBN: 0-672-32622-1). Check it out at your favorite bookstore today. Buy this book now.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.