Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
New Features
Instructor Guide
D14298GC10
Production 1.0
October 2002
D37333
Author Copyright Oracle Corporation, 2002. All rights reserved.
Pam Gamer
This documentation contains proprietary information of Oracle Corporation. It is
provided under a license agreement containing restrictions on use and disclosure and
is also protected by copyright law. Reverse engineering of the software is prohibited.
Technical Contributors If this documentation is delivered to a U.S. Government Agency of the Department of
Defense, then it is delivered with Restricted Rights and the following legend is
and Reviewers applicable:
Yanti Chang
Laurent Dereac Restricted Rights Legend
Ellen Gravina
Use, duplication or disclosure by the Government is subject to restrictions for
Jonas Jacobi commercial computer software and shall be deemed to be Restricted Rights software
Chris Lewis under Federal law, as set forth in subparagraph (c)(1)(ii) of DFARS 252.227-7013,
Chris Lowes Rights in Technical Data and Computer Software (October 1988).
Marcelo Manzano
This material or any portion of it may not be copied in any form or by any means
Duncan Mills without the express prior written permission of Oracle Corporation. Any other copying
Frank Nimphius is a violation of copyright law and may result in civil and/or criminal penalties.
Kavitha Prakash
If this documentation is delivered to a U.S. Government Agency not within the
Jasmin Robayo
Department of Defense, then it is delivered with Restricted Rights, as defined in
Bryan Roberts FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987).
Grant Ronald
Raza Siddiqui The information in this document is subject to change without notice. If you find any
problems in the documentation, please report them in writing to Education Products,
Sarah Spicer
Oracle Corporation, 500 Oracle Parkway, Box SB-6, Redwood Shores, CA 94065.
Jack Walsh Oracle Corporation does not warrant that this document is error-free.
Ken Woolfe
Robin Zimmerman Oracle and Express, Express Analyzer, Express Objects, Express Server, Personal
Express are trademarks or registered trademarks of Oracle Corporation.
All other products or company names are used for identification purposes only, and
Publisher may be trademarks of their respective owners.
Christine Markusic
Contents
Preface
Introduction
Course Objectives I-2
Agenda I-3
Summit Office Supply Schema I-7
The Course Application I-8
iii
The Java Run-time Environment 2-19
Applet Instance Caching and JInitiator 1.3 2-20
Testing a Form: Starting Oracle Containers for Java (OC4J) 2-21
Testing a Form: Starting OC4J 2-22
Testing a Form: The Run Form Button 2-23
Customizing the Forms Services Configuration 2-24
Defining Forms Environment Variables for Run Time 2-25
Defining Forms Environment Variables for Design Time 2-26
Defining Forms Servlet Parameters 2-27
Defining Application-Specific Configurations 2-28
Summary 2-29
Practice 2 Overview 2-31
iv
Saving and Compiling Modules 4-13
Loading Existing Modules 4-15
Using an Iterator 4-16
Modifying Forms Objects 4-17
Deleting Forms Objects 4-18
Copying and Subclassing 4-20
Handling Exceptions 4-21
Writing Generic Code 4-22
Special Cases in JDAPI Programming 4-23
Practice 4a 4-24
Why Convert Forms to XML? 4-27
XML Conversion Utilities 4-28
Converting a Forms Module to XML 4-29
Converting XML to a Forms Module: 4-30
Generating the Forms XML Schema File 4-31
Validating XML 4-32
XML Conversion Utilities Example 4-33
Summary 4-36
Practice 4b 4-38
v
6 Integrating Java into Forms Applications
Objectives 6-2
Using Java in Forms 6-3
Support for Java 1.3 6-4
Using Client-Side Code 6-5
What Are JavaBeans? 6-7
What Are Pluggable Java Components? 6-8
Interacting with JavaBeans 6-9
Introducing the FBean Package 6-10
The FBean Package 6-11
Registering the Bean 6-13
Setting Bean Area Item Properties 6-14
Setting JavaBean Properties 6-15
Responding to Events 6-16
Interacting with Non-Event JavaBeans 6-18
Deploying JavaBeans for Forms Applications 6-19
Summary 6-21
Practice 6 Overview 6-22
vi
Installing the TranslationHub Schema 8-16
Starting TranslationHub 8-17
The TranslationHub User Interface 8-18
Translating Applications 8-19
Constructing a Translation Project 8-20
Translating the Text 8-22
Building the Translated Software 8-23
Summary 8-24
Practice 8 Overview 8-27
A Practice Solutions
D Table Descriptions
vii
Preface
Oracle9i Forms Developer: New Features Preface - 2
Profile
Oracle Publications
Title Part Number
Oracle9iAS Forms Services Deployment Guide A92175-01
Release 9.0.2
Oracle9iDS Forms Developer Reference Guide A97289-01
Oracle9i Forms Developer and Forms Services A92183-01
Migrating Forms Applications from Forms6i
Oracle9i Forms Developer and Forms Services
Migration Assistant (addendum to P/N A92183-01)
Additional Publications
Release notes:
<ORACLE_HOME>\doc\ids902welcome\relnotes\forms_developer\forms_relnotes.
pdf and toc.html
Release notes addendum:
http://otn.oracle.com/docs/products/forms/902docs/902formsaddendum.pdf
Bold italic Glossary terms (if there is a The algorithm inserts the new key.
glossary)
Quotation Lesson and chapter This subject is covered in Unit II, Lesson 3, Working with
marks titles in cross Objects.
references, interface
elements with long Select the Include a reusable module component and
names that have only click Finish.
initial caps
Use the WHERE clause of query property.
Course Aim
As an experienced Forms developer, you will learn how to leverage the benefits of
Oracle9i Forms. You will use the migration utility to upgrade a Forms application
developed in Forms6i, and then enhance the application using new features of Oracle9i
Forms.
Day 1:
Lesson 1 Why Upgrade to Oracle9i Forms?
Lesson 2 Migrating Existing Applications to
Oracle9i Forms
Lesson 3 Deploying Forms Applications on the
Internet
Lesson 4 Designing Forms Modules outside
the Builder
Lesson Topics
Lesson 1: Why Upgrade to Oracle9i Forms?
Oracle9i Developer Suite Overview
Oracle9i Forms Overview
- Productivity enhancements
- Globalization
- Integration
- Openness
- Web only
Benefits of Oracle9i Forms
Streamlining Oracle9i Forms
- Elimination of character mode and client-server run-time executables
- Elimination of item types and built-ins that are OS-specific or related to
character mode
- Elimination of features that are holdovers from older versions of Forms
Day 2:
Lesson 5 Troubleshooting Forms Applications
Lesson 6 Integrating Java into Forms
Applications
Lesson 7 Enhancing the User Experience
Lesson 8 Deploying Forms Applications Globally
1 2 3 4 5 6 7
Lesson Aim
This lesson describes the features and benefits of Oracle9i Forms. You learn how it fits
within Oracle9i Developer Suite and how obsolete features have been eliminated in order
to streamline the product.
Note: If you encounter terminology that is unfamiliar, refer to
http://www.oracle.com/glossary for definitions.
Oracle9i Products
Oracle9i Database manages all of your information including Word documents, Excel
spreadsheets, XML, and images. Oracle9iDS tools can automatically reuse the database
structure and its integrity constraints, which reduces the amount of manual coding.
Oracle9i Application Server (Oracle9iAS) runs all of your applications: Java, wireless,
portals, and business intelligence. Using Oracle9iAS, all applications developed with
Oracle9iDS can be deployed and managed in a single application server. The Oracle9i
Application Server contains Oracle9i Forms Services that you use to deploy your Forms
applications.
Oracle9i Developer Suite (Oracle9iDS) leverages the infrastructure offered by Oracle9i
Application Server (Oracle9iAS) and Oracle9i Database, enabling developers to build
scalable, secure, and reliable e-business applications quickly and easily. The suite
provides a complete and highly productive development environment for building
applications. Oracle9i Forms Developer is part of Oracle9i Developer Suite.
This lesson focuses on Oracle9i Developer Suite, while the next lesson provides more
detail about Oracle9i Application Server.
Application Development
Discoverer
Designer
OWB
Forms
Reports
JDeveloper
SCM
Business Intelligence
Cost Openness
effective with Java
Summary
Including Oracle Forms Developer as part of Oracle9i Developer Suite provides access to
a variety of tools to build Internet applications. Other application development tools
included are JDeveloper, Designer, and Software Configuration Manager. Business
Intelligence is provided by tools such as Warehouse Builder, Discoverer, and Reports.
Oracle9i Forms is optimized for Web deployment. It enables you to provide users with a
rich Java interface without any Java coding. You can rapidly develop new applications
and take advantage of the functionality built into the Forms product, such as transaction
and record management, automatic creation and coordination of master-detail
relationships, and so on. You can migrate existing character mode or client-server
applications to the Web with little or no modification by upgrading them to Oracle9i
Forms.
Summary (continued)
Because Oracle9i Forms is for Web deployment, the product has been streamlined to
eliminate properties, built-ins, and item types related to character mode, client-server, and
older versions of Forms. This enables Oracle to focus its development efforts on
enhancing the functionality, performance, and scalability of applications deployed on the
Web.
Lesson Aim
This lesson describes the architecture of Oracle9i Application Server, presenting detailed
information about OC4J and Forms Services as the components of 9iAS used to deploy
Forms applications to the Internet. You also learn how to use the OC4J that is included
with Oracle9i Developer Suite to test Forms modules from within Forms Builder.
If some of the terms used in this lesson are unfamiliar to you, refer to the glossary
available at: http://www.oracle.com/glossary.
Oracle9iAS
Oracle9iAS
Containers
Forms Services
for J2EE
A component of
Oracle9i Application
Server that deploys Oracle9iAS
J2EE applications containers
for J2EE
What Is OC4J?
Oracle9iAS Containers for J2EE (OC4J) is Oracles Java 2 Enterprise Edition (J2EE)
container that executes on any Java Virtual Machine (the JVM provided on each operating
system and hardware platform). It is implemented completely in Java, making it
lightweight and easy to install. At the same time, it provides complete support for J2EE
applications, including servlets, Enterprise JavaBeans, Java Server Pages, and so on.
OC4J is ideally suited to run Forms applications. Oracle9iAS Forms Services are
deployed within OC4J, offering improved performance and scalability. When the
Oracle9iAS HTTP Server (OHS) receives a request for a Forms application, its
mod_oc4j component routes the request to OC4J.
Later in this lesson, you will see that you can also test Forms applications by running
them in OC4J directly from Forms Builder. In this case, OC4J acts as a lightweight Web
listener as well as a Servlet container.
A component of
Oracle9i Application
Server that deploys Oracle9iAS
Forms applications to Forms Services
Java clients in a Web
environment
Forms Listener
Servlet
Forms Servlet
Forms Runtime
Incrementally User
User interface
interface Net
downloaded layer Services DB
Application
logic layer
Data manager/
JRE PL/SQL engine
Java applet
Files containing
application code
Responsibilities:
Displays the forms user
interface
Processes user interaction
Forms Client
back to Forms Services
Processes incoming Generic
messages Java applet
from Forms Services
How do I
access this
application? http://summit.com:80/forms90/f90servlet?form=customers.fmx&userid=ora1/oracle@
How do I access
this new
application?
http://summit.com:80/forms90/f90servlet
?form=customers.fmx&userid=username/password@database
&buffer_records=NO&debug_messages=NO&array=YES
&query_only=NO
Web Browser
1
URL
2
http://summit.com:80/forms90/f90se
Oracle9iAS OC4J
HTTP Servlet Engine
Server Forms
Servlet
MOD_OC4J
Forms
Listener
Servlet
3 Forms
Runtime
Engine
Web Browser
4
URL http://summit.com:80/forms90/f90se Oracle9iAS OC4J
HTTP Servlet Engine
Server Forms
Servlet
MOD_OC4J
Forms
Listener
Applet Servlet
5 6
started
Forms
Runtime
6 Engine
6
Forms Application Executables
FMX files MMX files PLX files DB
Web Browser
URL http://summit.com:80/forms90/f90se
Oracle9iAS OC4J
7 HTTP Servlet Engine
Server Forms
Servlet
MOD_OC4J
Forms
8 Listener
Servlet
8
Forms
Runtime
Engine
Forms Developer
Starting OC4J
As you learned earlier in this lesson, Oracle Containers for J2EE (OC4J) is the Servlet
container that is used to run a Forms application. Although it is a component of
Oracle9iAS, OC4J is also included in Oracle9i Developer Suite to enable you to test your
applications on the same machine on which you are running Forms Builder. In this role,
OC4J functions both as a lightweight Web listener and as a Servlet container. In other
words, you do not need to install Oracle9iAS to test, but you must install it to deploy your
production applications.
To use OC4J on Windows NT, you start it by executing the batch file provided, called
startinst.bat. This file is located in the j2ee\Oracle9iDS\ subdirectory of
your 9iDS ORACLE_HOME. You can execute these batch files on Windows NT from the
Start Menu: Programs > Oracle9i Developer Suite > Forms Developer > Start (or
Shutdown) OC4J Instance.
If you will be testing applications on your client machine, you can set up a desktop
shortcut to this batch file, and also to the stopinst.bat batch file used to stop the
OC4J instance.
Windows: Modify in
Registry (REGEDIT.EXE
or REGEDT32.EXE)
Summary
Oracle9iAS is a layered middle-tier architecture for developing and deploying Internet
applications. It contains several services that are used for deployment of Forms
applications:
Oracle9iAS Containers for J2EE (OC4J): A lightweight container for J2EE applications.
URL requests for Forms Services applications are redirected by mod_oc4j to OC4J.
OC4J can also function as a lightweight Web listener for testing Forms applications.
Summary (continued)
Forms Services:
Forms Servlet: Constructs the HTML file that starts the applet
Forms Client: A Java applet that displays the user interface on the client
Forms Listener Servlet: Maintains a connection between the client and the Runtime
Engine, through the HTTP Server
Forms Runtime Engine: Handles all the application logic and Forms functionality;
communicates with the Forms client and the database
Practice 2 Overview
In this practice, you set Runtime preferences in Forms Builder to use OC4J. You also set
an applet parameter in the Runtime preferences. You define some applet parameters in a
named configuration, then set the Runtime preferences to use the named configuration.
You configure the Forms Servlet to use a different configuration file, and you set
environment variables in the environment configuration file. You use the Run Form
button to test the settings.
Note: The correct way to exit a Forms session is to exit the form (File > Exit, or click
Exit), then close the browser. If you close the browser without first exiting the form, your
session may hang. You will notice this because you will not be able to recompile the same
form, but will receive the error: FRM-30087: Unable to create form file.
If this happens, you will need to open Task Manager and kill the ifweb90 process
manually.
Instructor Note
Please emphasize to students the correct way to exit a Forms session.
4. Add a parameter to the Run-Time preferences. Specify that the Forms application
should open in a separate browser window by setting the separateFrame
parameter to True.
5. Define a named configuration called [summit] that specifies the form to run, the
connect string, and the separateFrame parameter set to True. Set the Forms
Builder preferences to use the named configuration. Run the form to test the setting.
Hint: You should stop OC4J before modifying the Forms Web configuration file.
Modify the web.xml configuration file for OC4J so that the new Forms Servlet
configuration file (Summit.cfg) is used.
Set your Forms Builder Run-Time preferences back to the default. Run the form to
test the setting. Do not close the browser because it must be open for the next
exercise.
Hint: You should stop OC4J before modifying the OC4J configuration file.
7. Edit the URL in the browser by deleting all parameters. Open the new URL.
9. From Forms Builder, run the Customers form normally. Click Orders. The Orders
form should display. Exit the forms and the browser.
10. Move the Orders form (Orders.fmx) from the lab directory to a temporary
directory, such as e:\temp. You can first create this directory if it does not already
exist. From Forms Builder, run the Customers form again and click Orders. What
happens and why? Exit the Customers form and the browser.
__________________________________________________________________
__________________________________________________________________
11. Modify the Forms environment to add e:\temp to the search path. Do not use the
Windows Registry to set the environment. Run the Customers form again and click
Orders to test that the Orders form is successfully located. Exit the forms and the
browser.
Lesson Aim
This lesson describes the migration path, method, and issues in upgrading to Oracle9i
Forms. You learn how to successfully migrate to Oracle9i Forms from previous versions.
Forms
Forms 4.0
2.0
f45gen32 ifcmp60
Forms Forms Oracle9i
Forms
4.5 6i Forms
2.3
Forms Forms
3.0 5.0
Migration Path
The only supported way to upgrade directly to Oracle9i Forms is from Forms6i or 6.0.
Older versions of Forms applications will need one or more interim upgrades:
Forms 4.0, 4.5, or 5.0 applications will first need to be upgraded to Forms6i.
Although it should work to upgrade directly from 6.0, it is not supported to do so.
Forms 2.0, 2.3, or 3.0 applications will first need to be upgraded to Forms 4.5, then
to Forms6i.
For instructions for upgrading older versions, refer to the following white papers,
available on OTN:
Upgrade Developer Forms 4.5 to Oracle Forms 6
Migrating SQL*Forms 3.0 Applications to Internet Computing
Issues:
V2-style triggers
V2.3-style LOVs
Windows and canvases
SQL*Menu 5.0 (with SQL*Forms 3.0)
Runtime Compatibility Mode
PL/SQL conversion issues v.1 to v.2, v.8, and v.9
(for example, CHAR to VARCHAR2)
Item data types
Obsolete item types
Issues:
Client support
Images
Icons
JAR files
Key mappings
Mouse enter/leave/move triggers
OS-specific item types
Fonts
Access to client machine
Program calls (HOST, user exits, OLE automation)
run on middle tier
Access to client machine: The Java applet for the user interface does not allow access
to the client machine for such operations as file upload/download or printing. To
accomplish these tasks, use a JavaBean; see Lesson 7 for more information.
Program calls: Programs such as the HOST command, user exits, and OLE
automation run on the middle tier. You can use them as long as there is no UI
component, necessary files are on the middle tier machine, and any OS-specific
commands used are for the middle tier platform.
Note: For additional information see the Oracle9i Forms: Migrating Client/Server to the
Web white paper, available on OTN.
Instructor Note
Mention these issues briefly, but do not go into detail unless students have specific
questions.
Issues:
Application logic
Item length (WIDEN_FIELDS=YES)
Navigation
Fonts
Command:
ifplsqlconv90 (Windows) or ifplsqlconv (UNIX)
Arguments:
module (required)
userid (optional)
log (optional)
Practice 3a Overview
In this practice you use the Oracle9i Forms Migration Assistant:
On a single form
On multiple forms using a batch file
You will modify the settings for the Migration Assistant so that it automatically connects
to the database and generates the executables.
You will upgrade the Summit Office Supply application from Forms6i.
Integrating Graphics
Oracle Graphics is not shipped with Oracle9i Forms, and the charting wizard has been
removed from Forms Builder. For new applications, use a JavaBean, such as one written
with the Chart User Interface Component of Oracle9iDS JDeveloper.
Using chart objects or RUN_PRODUCT calls, you can upgrade and deploy existing
Forms applications that contain embedded Oracle Graphics displays. You can also edit
chart item properties, create new chart items, and populate chart items with existing OGD
files that were created in 6i. This requires the following actions:
Install Oracle Graphics 6i in a separate ORACLE_HOME on the same machine as
Oracle9iAS Forms Services.
Set the ORACLE_GRAPHICS6I_HOME environment variable to the directory
where you installed Graphics 6i.
Set the path for the Forms servlet environment (in default.env or equivalent) to
include the Graphics executable:
PATH=%FORMS9I_HOME%\bin;%ORACLE_GRAPHICS6I_HOME%\bin;
If you use the OG.PLL library in your application, compile it in Oracle9i Forms.
Note: For additional information see the February 2002 Oracle white paper, Deploying
Oracle Graphics in Oracle9iAS V2 Forms Services, available on OTN.
Integrating Reports
You should use RUN_PRODUCT in Oracle9i Forms only for integration with Oracle
Graphics. RUN_PRODUCT calls being used to integrate Forms with Reports should be
replaced using the RUN_REPORT_OBJECT built-in, using Reports Server to run the
report. The Reports Server must be configured and running when you invoke the report
from Forms.
The following slides present detailed information about using RUN_REPORT_OBJECT to
run a report. This is not a new feature of Oracle9i Forms; however, previous Forms
versions allowed the use of RUN_PRODUCT, so it is possible that you may not have used
RUN_REPORT_OBJECT. If you have experience with running reports this way, the
remainder of this lesson will be a review of this topic.
Instructor Note
This lesson uses the Reports Server to run reports. Students will use the Reports Server on
the instructor machine. You will need to start the Reports Server on your machine by
running the batch file RepSRV.bat, located in your demo directory.
SET_REPORT_OBJECT_PROPERTY(v_repid,
REPORT_COMM_MODE, SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(v_repid,
REPORT_DESTYPE, CACHE);
SET_REPORT_OBJECT_PROPERTY(v_repid,
REPORT_DESFORMAT, html);
SET_REPORT_OBJECT_PROPERTY(v_repid,
REPORT_SERVER, RepSRV);
SET_REPORT_OBJECT_PROPERTY(v_repid,
REPORT_OTHER, ordno=||:orders.order_id);
Parameter name
matches parameter
defined in Reports
Builder
Set at design time:
RUN_REPORT_OBJECT:
Function that returns VARCHAR2 value to
uniquely identify the report
Overloaded to take the following combinations of
arguments:
Report name
Report ID
Report name, parameter list
Report ID, parameter list
Use REPORT_OBJECT_STATUS to determine when
report has finished
WEB.SHOW_DOCUMENT:
Used to display any Web page from Forms
Use to display a report in the browser
Not necessary when just printing
Takes 2 arguments:
URL: VARCHAR2
Target: _self | _parent | _top | _blank
Use getjobid to retrieve the report from the
Reports Server
Can be used as alternative to
RUN_REPORT_OBJECT to run a report
Alternative to RUN_REPORT_OBJECT
Construct the URL to be the same as you would
use to run a report in a browser with the Reports
Servlet:
http://pgamer-wah.us.oracle.com:8888/
reports/rwservlet?report=emps.jsp&destype=cache
&desformat=html&userid=ora1/oracle@iasdb
Summary
You can directly upgrade applications written in Forms6i to Oracle9i Forms. Applications
written in versions between 4.0 and 5.0 (including 4.5) must first be upgraded to 6i. If
your application was written in 2.0, 2.3, or 3.0, you must first upgrade it to 4.5, then 6i,
then 9i. You may need to perform some manual steps in 4.5 to rewrite obsolete triggers or
resolve some user interface issues.
The Oracle9i Forms Migration Assistant facilitates the task of migrating applications. It
provides feedback and error messages, and its functions are customizable.
Although Oracle9i Developer Suite does not have a graphics component, you can use
graphics from Oracle Developer 6i that have been installed into a separate
ORACLE_HOME. You can embed a graphics object into a form, or use RUN_PRODUCT.
Summary (continued)
The RUN_PRODUCT built-in no longer works to integrate reports. You can use
RUN_REPORT_OBJECT to achieve a high degree of control and flexibility in running
reports from forms. You can use WEB.SHOW_DOCUMENT to display or to run a report.
You might need to perform many manual tasks to resolve issues when upgrading
applications. These issues vary depending on whether you are upgrading from client-
server, character mode, or Forms Listener deployment.
Practice 3b Overview
In this practice, you examine the method used by the Migration Assistant to convert
RUN_PRODUCT calls to RUN_REPORT_OBJECT. You then perform this conversion
directly and display the report with WEB.SHOW_DOCUMENT.
Instructor Note
This practice uses the Reports Server to run reports. Students will use the Reports Server
on the instructor machine. If you have not already done so, you will need to start the
Reports Server on your machine by running the batch file RepSRV.bat, located in your
demo directory.
Lesson Aim
This lesson describe methods of modifying Forms applications without making manual
modifications in Forms Builder.
API
Forms Builder
Speed
Number of modules
API
Accuracy
Number of modules
Forms
CFAPI JDAPI
Module
Use for:
Form modules
Menu modules
Object libraries
PL/SQL libraries
(load & inspect)
Using JDAPI
The Java Design-time API acts upon Forms objects by using the Java Native Interface
(JNI) to call the Forms stack. You cannot use JDAPI at run time to control or interact with
running Forms modules.
You can manipulate all types of Forms modules: Forms, menus, object libraries, and
PL/SQL libraries. However, as with the C API, there is only limited functionality for
PL/SQL libraries. You can load them and inspect the contents, but cannot modify or save
them. Because PL/SQL libraries have a text-format alternative (with a .pld extension),
you can generate a text file of PL/SQL code without the JDAPI, save it as a pld file, and
compile it using the Forms command-line compiler. You can use the JDAPI to create and
modify library attachments on form and menu modules, as with any other Forms object.
Note: You can download the JDAPI javadoc from:
http://otn.oracle.com/docs/ products/forms/content.html. Scroll to the
section labeled Javadoc.
Instructor Note
As you present JDAPI constructs in the following slides, demonstrate the pertinent
javadoc to the students.
r
ja
api.
d
0j
\f9
va
ja
0\
s9
rm
fo
JDAPI Architecture
JDAPI consists of a single oracle.forms.jdapi package contained in f90jdapi.jar
in the forms90\java subdirectory of ORACLE_HOME. To use JDAPI, you must set your
CLASSPATH to include this JAR file.
The package contains interfaces, abstract types, utility classes, and classes that represent
all Forms objects. The above diagram, taken from Forms online help, depicts the
architecture of JDAPI. The diagram is continued on the next slide.
Forms objects are sets of properties of Boolean, integer, string, and object types. The
Forms object classes implement the JdapiObject interface, which is the fundamental
type of all objects. The JdapiObject interface includes generic property accessors to get
and set properties by type, such as JdapiObject.getStringProperty(),
JdapiObject.setStringProperty(), JdapiObject.getIntegerProperty(),
and so on.
In addition to these generic methods, the Forms object classes have their own accessor
methods that are specific to the object. For example, the Font class has a
getFontSize() method that returns an integer, so you need not use the more generic
JdapiObject.getIntegerProperty().
Creating Modules
To create a module, you simply call its constructor and instantiate it, as in the example
above. The example is equivalent to pressing the Create button in the Forms Builder
Object Navigator with the Forms node selected, then renaming the module to "myform."
You can create modules of the following types: FormModule, MenuModule, or
ObjectLibrary. You cannot create modules of the PlsqlModule type that has no
public constructor. As stated previously, the only JDAPI actions you can take with a
PL/SQL library module are to load it and inspect its contents.
Instructor Note
Show students the constructor for FormModule in javadoc. Note that there is also a
protected constructor (not shown above). Explain to students that this is for Forms internal
use only, and is not to be used in JDAPI programs. Scroll down to the Constructor Detail
section of the FormModule javadoc for further explanation of a protected constructor.
The slides show screenshots of performing equivalent actions in Forms Builder. Be sure
students make the connection between what they would do in Forms Builder and what
they can do with JDAPI.
....
FormModule fmd = new FormModule("myform");
Block blockA = new Block(fmd,"EMPLOYEES");
Item itemA = new Item(blockA,"employee_id");
Item itemB = new Item(blockA,"last_name");
Item itemC = new Item(blockA,"first_name");
....
....
FormModule fmd = new FormModule("myform");
Block blockA = new Block(fmd,"EMPLOYEES");
Item itemA = new Item(blockA,"employee_id");
Item itemB = new Item(blockA,"last_name");
Item itemC = new Item(blockA,"first_name");
fmd.save("EMPLOYEES_JDAPI.fmb");
fmd.compile();
....
Instructor Note
Demonstration
Create a form using JDAPI and examine the new form in Forms Builder. Complete
instructions for this demonstration are in the JDAPI_CreateForm.txt file, located in
your demonstration directory. The Java code (as shown above) is in the
CreateForm.java file.
....
Canvas cnv = new Canvas(fmd,"EMP_CV");
int xPos = 10; int yPos = 10;
JdapiIterator blocks = fmd.getBlocks();
while(blocks.hasNext())
{
Block myBlock = (Block)blocks.next();
// Code to process the block goes here
}
....
Using an Iterator
To work with child objects of a Forms object, you must retrieve all such objects using an
iterator, which you declare to be of type JdapiIterator. You can think of an iterator
as an array, or list, of objects.
All of the classes for each Forms object that could have children have methods to access
those children. These methods, such as FormModule.getBlocks() shown in the
example above, return a JdapiIterator type.
After you have instantiated the iterator, as by assigning it to a variable such as blocks in
the example, you can traverse through the children by using the next() method of the
JdapiIterator interface. When the iterator is first instantiated, you must invoke the
next() method to get to the first object in the list. Note that the iterator returns the
generic type java.lang.Object, so you must cast it to the desired data type, which is
Block in the example.
You can use the hasNext() method, which returns Boolean, to test whether you are at
the end of the list.
Note: In the example above, prior to creating the iterator, a canvas is created and some
integer variables are initialized. These will be used to place items on a canvas.
....
while(items.hasNext())
{
Item myItem = (Item)items.next();
if (myItem.getName().equals("FIRST_NAME"))
{
myItem.destroy();
}
else
{
myItem.setCanvasObject(cnv);
myItem.setXPosition(xPos);
myItem.setYPosition(yPos);
yPos = yPos + 20;
}
}
....
Instructor Note
Demonstration
Modify a form using JDAPI and examine the changed form in Forms Builder. Complete
instructions for this demo are in the JDAPI_ModifyForm.txt file.
myblock.clone(fmd2,"EMPLOYEES");
Subclassing:
At object construction:
Post-construction:
blockB.setSubclassParent(blockA);
Handling Exceptions
All exceptions thrown by JDAPI extend JdapiException, which in its turn extends
java.lang.RuntimeException. Although this means that almost every JDAPI
method can throw an exception, and that you are not required to specifically write
trycatch code for these exceptions, it is good practice to do this. As a suggestion, you
could follow each try... block with several catch... Block codes, catching
first the JDAPI exceptions and then more generic exceptions.
The JDAPI exceptions are:
JdapiException: The base type; thrown in many cases. May be thrown by the
underlying Forms code on failing to create Forms objects.
JdapiIllegalStateException: Thrown by any Forms object class when a
method is called and the class instance does not reference a valid Forms object (for
example, after the Forms object has been destroyed).
JdapiUnsupportedOperationException: Thrown by the remove()
method of JDAPI iterators, which do not support the functionality, and by the
compile() method of the PlsqlLibrary class.
Practice 4a Overview
In this practice, you install javadoc for the JDAPI and XML conversion tools and use
the javadoc to answer some questions about JDAPI. You modify the Orders form by
writing, compiling, and executing a JDAPI program.
Instructor Note
Students unfamiliar with Java might have trouble writing the JDAPI program from
scratch. If this is the case, have them copy the ModifyOrders.java file from their
solutions directory to the lab directory. They should then be able to follow the instructions
to compile and run the ModifyOrders class.
1. Install the javadoc for JDAPI and XML tools. The javadoc file that was
downloaded from OTN is called javadocJDAPIXML.zip. Unzip the file into a
new labs\javadocJDAPIXML directory.
3. Use the javadoc for JDAPI to answer the following questions, then close the
javadoc browser window:
a. What class would you use to access an Attached Library in a Forms module?
_____________________________________________________________
b. What method of that class would you use to find out the location of the
library?
_____________________________________________________________
_____________________________________________________________
4. In Notepad, write a JDAPI program (a .java file) to modify the Orders form by
changing the X position and the width of the Order_Date item. The new X
position should be 340 and the width should be 95. Save and compile the modified
form.
Note: To compile this form, you must connect the JDAPI session to the database.
Look at the javadoc for the JDAPI class to discover the methods to call in order to
connect to the database prior to compiling the form. Disconnect from the database
after the compilation.
Hint: If you are familiar with Java, try to write this code yourself. However, if you
need help, the ModifyOrders.java file in your solutions directory contains the
required code.
5. Compile and run the ModifyOrders class that you have written. You can run the
SetCP.bat batch file to set your CLASSPATH so that the JDAPI classes can be
located.
6. Check to see that the Orders form compiled successfully. If an Orders.err file
was created, open it to examine the output. Open the Orders form in Forms Builder
to make sure that the X position and Width properties of Orders.Order_Items
have been modified. Then close all forms in Forms Builder.
XML is:
Simple
Easy to read
Platform-independent
XML files can be used by other tools.
Conversion utilities can be used from command line or
Java.
XML documents can be used for:
Programmatic manipulation of Forms modules
Custom documentation
Operations such as diffing and merging
Validating XML
The rules for XML files are strict. A forgotten tag or an attribute without quotes makes an
XML file unusable.
In many cases, you do not need to explicitly validate the XML because the XML to Forms
tools performs such validation internally. However, if you have either created new XML
or modified the generated XML, you may want to explicitly validate it before converting
it to a Forms module or using it in a Java program.
You can use the XML Validator as follows:
From the command line:
java oracle.forms.util.xmltools.XMLValidator <filename>.xml
From the command line using the convenience script, which sets the CLASSPATH
for you: ifxmlv90 <filename>.xml
From Java: You can define an object of type XMLValidator and use it in a
try/catch block to validate an XML file, represented by doc in the example:
XMLValidator validator = new XMLValidator();
try { validator.validateXML(doc); }
catch(Exception e) { //code to handle exception }
>iff2xml90 EMPLOYEES_JDAPI.fmb
Oracle9i Forms to XML Tool
Copyright(c) Oracle Corporation 2001. All rights reserved.
Processing module EMPLOYEES_JDAPI.fmb
XML Module saved as EMPLOYEES_JDAPI_fmb.xml
Instructor Note
Demonstration
Show students how to run the convenience scripts. Complete instructions for this demo
are in the file are in the file XMLexample.txt, located in your demo directory.
>del EMPLOYEES_JDAPI.fmb
Validate XML
>ifxmlv90 EMPLOYEES_JDAPI_fmb.xml
Oracle9i Forms XML Validator
Copyright(c) Oracle Corporation 2001. All rights reserved.
EMPLOYEES_JDAPI_fmb.xml validated against the Forms XML Schema.
>ifxmlsg90
Oracle9i Forms XML Schema Generator
Copyright(c) Oracle Corporation 2001. All rights reserved.
Forms XML Schema saved as forms90.xsd
Summary
There are three ways to modify Forms modules without opening Forms Builder:
The Forms C API (CFAPI)
The Java Design-Time API (JDAPI)
XML conversion tools
JDAPI and the XML conversion tools are new with Oracle9i Forms.
Using these tools to modify a larger number of forms results in greater accuracy and
productivity than with opening each form individually in Forms Builder to modify it.
Summary (continued)
JDAPI provides Java classes that enable you to create and modify Forms modules,
including forms, menus, and object libraries. You can programmatically accomplish
almost anything that you can do manually with Forms Builder.
With the XML conversion tools, you can convert Forms modules to XML and vice versa.
You can generate an XML file of the internal Forms Schema or validate XML against the
internal Forms Schema. You can use the XML tools from the command line or from a
Java program.
JDAPI and XML conversion tools provide developers with the flexibility to employ
various methods to modify and document Forms modules accurately and efficiently.
Practice 4b Overview
In this practice, you use the XML conversion tools to convert a form module to XML,
modify the XML file, and convert it back to an .fmb file. You then open the .fmb file in
Forms Builder to test that the modification was made. You also validate XML after
deliberately introducing an error into the file, and you generate the Forms Schema XML
document.
1. Convert the Customers form to XML. Examine the structure of the XML file. In
WordPad, open xml_structure.txt to help you examine the tree structure of
the XML.
2. In the XML file, change the background color of the Account_Mgr_Name item to
red and the foreground color of that item to white.
4. Using the convenience script, convert the XML file back to a .fmb, then open the
form in Forms Builder and run it to test the change. Then close the form in Forms
Builder.
Hint: You will need to connect to the database when you convert this XML to an
.fmb file.
6. Change the three colors (Foreground Color, Background Color, and Prompt Color)
back to their default values without opening Forms Builder. Then open the form in
Forms Builder to verify that the changes have been made.
7. Create an error in the customers_fmb.xml file by deleting any of the end tags.
For example, delete the final ">" in the section for one of the items. Then validate
the XML to see the errors that appear.
8. Would you usually need to generate an external Forms Schema file? Under what
conditions would such a file be required?
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
9. Create a file that represents the Forms Schema. Open that file (forms90.xsd) in
WordPad to examine the structure of the Forms Schema, consisting of all the
possible tags that can be used for Forms elements and attributes. Examine the
attributes defined for the Item element. You should see the attributes that you
modified in earlier exercises.
Lesson Aim
This lesson describes the new Forms facilities for debugging, tracing, and logging.
Displaying debug
messages at run
time
Invoking the
PL/SQL Debugger
Stack
Variables
Watch
Form Values
Loaded PL/SQL
Packages
Global and Dock/
System Variables Undock
Breakpoints
Click
bar for
pop-up
menu
Stack
Variables
Watch
Form Values
Loaded PL/SQL
Packages
Global and
System Variables
Breakpoints
Stack
Variables
Watch
Form Values
Loaded PL/SQL
Packages
Global and
System Variables
Breakpoints
Read-only:
Modifiable:
Stack
Variables
Watch
Form Values
Loaded PL/SQL
Packages
Global and
System Variables
Breakpoints
Stack
Variables
Watch
Form Values
Loaded PL/SQL
Packages
Global and
System Variables
Breakpoints
Stack
Variables
Watch
Form Values
Loaded PL/SQL
Packages
Global and
System Variables
Breakpoints
Stack
Variables
Watch
Form Values
Loaded PL/SQL
Packages
Global and
System Variables
Breakpoints
Stack
Variables
Watch
Form Values
Loaded PL/SQL
Packages
Global and
System Variables
Breakpoints
Stack
Variables
Watch
Form Values
Loaded PL/SQL
Packages
Global and
System Variables
Breakpoints
Contains source
code and .FMX (Runs automatically)
executable run file
Runs Form in
Debug Mode on
Server specified
in Runtime
Preferences
Stop
Step Step
into out
GO
Debug Example
Procedure XYZ;
2 4
Function ABC; 3
3. The ABC function multiplies two variables and adds the result to the abc_param
input parameter.
4. The ABC function returns the result to the XYZ procedure.
5. The XYZ procedure adds the result to the xyz_param and displays it in the
console at the bottom of the form window.
FUNCTION abc (abc_param IN NUMBER) RETURN NUMBER IS
v_total NUMBER := 0;
v_num3 NUMBER := 3;
v_num6 NUMBER := 8;
/*-- wrong value should be 6 */
BEGIN
v_total := v_num3 * v_num6;
v_total := v_total + abc_param;
RETURN v_total;
END abc;
Note: In previous versions of Forms, you could change PL/SQL code on the fly in the
debugger. However, now that the debugger is integrated into Forms Builder, and the form
itself is running in a three-tier environment, this is no longer possible.
Instructor Note
Demonstration
Open the form DebugDemo.fmb in Forms Builder to show the students how to use the
debugger. Instructions for this demo are in DebugDemo.txt.
If a more complex demo is desired, open and run EMPLOYEES.fmb:
The various buttons in this form enable you to demonstrate the Package and Break
on Exceptions windows.
The Cause Exception button in the form causes a 1422 exception, so select that as
the exception on which to break.
The code error in the form is that the Update Salary button does not seem to change
the salary. Set a breakpoint in the When-Button-Pressed trigger for that button. The
actual error occurs in the sal.get_sal package procedure, which is called by the
When-Button-Pressed trigger of the Update Salary button. The lines:
IF p_action = UPDATE THEN
v_new_sal := p_old_sal;
END IF;
should be corrected to:
IF p_action = UPDATE THEN
v_new_sal := p_old_sal + v_new_sal;
END IF;
Remote Debugging
Oracle9i Forms enables the application developer to debug an application that is running
remotely within the Intranet. The application that is being debugged makes a call to the
built-in procedure Debug.Attach. This pops up a dialog containing machine and port
information, which the developer can then use from Forms Builder to attach to the
problem session in order to debug it. A direct socket connection is needed, so remote
debugging is usually not possible over the Internet unless the firewall allows a direct
socket connection.
This ability provides developers with a great head start in resolving problems. Rather than
having to obtain a list of instructions from an end user on how to reproduce the problem,
they can watch the problem happen as the user carries out the actions. If you want to
enable remote debugging, consider adding a hook into Debug.Attach within all your
application screens for activation by the user as required.
In the example illustrated above, the application developer has created a button that calls
Debug.Attach. With such a button or menu option, the user can find out the host and
port to convey that information to the developer who is debugging the problem.
Attach Debug
Attach Debug to
Help! My form
just disappeared!
Practice 5a Overview
In this practice, you run a form in debug mode and set a breakpoint. You examine various
aspects of the running form using the panes of the Debug Console, and you step through
the code to discover the coding error. Finally, you remotely debug an application that is
running on another machine.
2. Click Run Form to run the Customer form. Select the Account Information tab.
Click the LOV button that is to the right of the Account Manager ID. Notice that the
LOV does not display, and you receive a message that You have just cancelled the
List of Values. Exit the run-time form and close the browser window.
3. Click Run Form Debug to run the form in debug mode. In Forms Builder, set a
breakpoint in your When-Button-Pressed trigger for the
CONTROL.Account_Mgr_LOV_Button. In the running form, click the Account
Manager LOV button to invoke the debugger. Investigate the call stack. Try
stepping through the code to monitor its progress. Look at the Variables panel to see
the value of the parameters you passed to the procedure, and the value of the p_lov
variable in the procedure. How would this information help you to figure out where
the code was in error?
4. Add a button to the Control block of the Orders form. Place the button on the
CV_Order canvas. Set properties as follows (note that the Icon Filename property is
case sensitive):
Property Value
Name Check_Total_Button
Iconic Yes
Icon Filename check
Keyboard Navigable No
Mouse Navigate No
X Position 295
Y Position 220
Height 17
Width 17
The function of this button is to recheck the Order Total. Write a When-Button-
Pressed Trigger to loop through the records in the Order_Items block and
accumulate the calculated total (price * quantity) in a numeric variable. You should
intentionally make an error when initializing this variable (the intent is to initialize it
to zero, but you type 9 "by mistake").
Run the form, click the Check_Total_Button, and notice that the results are off by
$9.00 when compared with the calculated item labeled Order Total.
Run the form in Debug mode and click the button. When the Debug Console is
invoked, Look at the variable value in the Variables panel of the Debug Console.
As soon as the variable is initialized at 9, change the value of the variable to zero in
the Variables panel of the Debug Console before stepping into subsequent code.
The code should use the corrected value and the correct result should be displayed
on the message line. This indicates that the variable initialization is what should be
corrected in the code.
Stop the debug session. Correct the code and run the form normally to test.
6. Sales representative Janette King is using a query form to find out what
commissions she has earned. She calls the Help Desk because the form is under
calculating her commissions. Pair up with someone using another PC. Designate one
PC as the Help Desk PC and the other as Janettes PC. Perform the following:
Janettes PC:
A. Run the query form using the Help Desk PC as the middle tier. In your
browser, enter the URL:
http://<machine>:<port>/forms90/f90servlet?form=
e:\labs\debug_practice\practice6a_6.fmx&userid= <connect
string>
where <machine> and <port> are the machine and OC4J port of the Help
Desk PC, and <connect string> is your own connect string.
B. When the form displays, click Calculate Commission. The commission for the
displayed employee calculates correctly.
C. Press [Down Arrow] until the employee Janette King is displayed. Click
Calculate Commission. The commission is calculated incorrectly.
D. Scroll down and click Debug. The host and port to which the Help Desk must
attach is displayed.
default.env
Parameters:
Type of trace to perform
record=forms
tracegroup=
Types of events to trace
Individual event
Event set
Named event set
Combination
log=<filename>
What to call the log file
In formsweb.cfg:
[mytrace]
otherparams=record=forms tracegroup=custom1 log=mytrace.trc
Event types:
Lets see I want to
trace information Point event
about triggers.. Duration event
Built-in event
&tracegroup=66
Traceable Events
With Forms Trace you can collect information about certain events without the need to
trace every Forms action. This enables you to see only the specific information that is of
interest to you. In future versions of Forms, it is planned that you will be able to define
your own custom events.
Event types are as follows:
Point event: An event that is the result of a user action or internal signal for which
there is no discernible duration, such as displaying an error message on the status
line; creates one entry in the log file
Duration event: An event with a start and end, such as a trigger; creates a pair of
entries in the log file for the start and end event
Built-in event: An event associated with a built-in; creates varied information about
the event, such as argument values
In the example, the developer is having a problem with triggers in a form. It would help to
find out the order in which triggers are firing. The developer could turn on Debug
Messages, which would display a message each time a trigger fires, but this would be
disruptive to the tester of the form. Instead, the developer instructs the tester to use the
following parameters in the URL: record=form&tracegroup=66 (trigger events).
* These event numbers do not have a TYPE because they are not really events, but rather
details for events. For example, the State Delta is something you can choose to see, but it
is triggered by a real action or event.
Note: Event 132 (Socket start and end) is effectively desupported, because socket mode is
no longer used for connection. The Forms Listener Servlet communicates using HTTP or
HTTPS.
What information
will Forms Trace
give me about
triggers?
mylog.trc
TriggerName
BlockName
ItemName
FormID
Three-Tier Events:
Set CLASSPATH
DataFile -
binary file produced by Forms server
XMLFile -
XML output file name
URL -
database URL e.g. mymachine:1521:my_sid
UserName -
user name to access database
Password -
password to access database
-
You must specify URL, UserName and Password
to upload to database
CollectionID - user supplied id uniquely identifying the
collection after uploading to database
Regression - boolean controlling inclusion of time stamps in output
- if true (i.e. output will be used for regression testing)
then time stamps are not included in output
Oracle9iDS
Reports
You can also perform debug level logging for Forms Servlet:
http://<machine>:<port>/forms90/f90servlet/debug?config=summit
Servlet Logging
Because Oracle9iAS Forms Services deployment uses the Forms Listener Servlet, you can
obtain performance and other information using servlet logging. The servlet logging tool
available with Oracle9iAS Forms Services provides the following:
A record of all Forms sessions, including session start and end times, the user's IP
address, and host name (session-level logging)
Monitoring of Forms-related network traffic and performance (session-performance
and request-performance-level logging)
Verbose information for debugging site configuration problems (debug-level
logging)
Examples:
To start a performance-level trace using a parameter in the URL:
http://machine:port/forms90/f90servlet
?serverURL=/forms90/l90servlet/perf
To start session-level logging for all users, you would change the serverURL entry in the
default section of the formsweb.cfg file to the following:
serverURL=/forms90/l90servlet/session
Note: You can also perform debug level logging on the Forms Servlet, rather than the
Forms Listener Servlet, simply by appending /debug to the URL used to start the
application.
Example:
http://machine:port/forms90/f90servlet/debug?form=orders
In addition to recording information in the application log file, the same information is
displayed in the DOS window where OC4J was started.
Instructor Note
Demonstration:
You can show students some results of Forms Servlet logging and Forms Listener Servlet
logging by opening the application.log file that is in your demo directory. This
shows information logged when no servlet logging is specified, as well as session,
perf, and debug level logging for both the Forms Servlet and the Forms Listener
Servlet. You can see that session and perf logging for the Forms Servlet do not
produce any more information than when logging was not performed, because these
logging levels are applicable only to the Forms Listener Servlet.
Summary
The Oracle9i Forms Builder has an integrated debugger that enables you to set
breakpoints in any PL/SQL code and view various aspects of the running form in the
Debug Console. You can use the Run Form Debug button to run a form in debug mode,
and you can step through the code in a variety of ways.
Summary (continued)
With the Oracle9i Forms debugger, you can perform remote debugging within the Intranet
if you provide a way for the user running the application to call Debug.Attach from
the running form. This displays host and port information to which the developer can
attach from within Forms Builder. The developer can load the module and set
breakpoints; when a breakpoint is encountered in the running form, control switches to the
developers Forms Builder session. All the functionality of the debugger is then available
to troubleshoot the application.
Summary (continued)
Forms Trace is a new tool in Oracle9i Forms that enables you to create a log that contains
information about the events you specify. The trace file is not readable, but you can
translate it into XML. You can even save the information to the database in order to create
custom reports.
Servlet logging is another tool to help troubleshoot your applications. You can log
information about the session, the network, or performance, or you can record verbose
debug information. This can be done on a per-user basis, or for all users of the application.
The new debugging, tracing, and logging tools in Oracle9i Forms make it easier than ever
to troubleshoot your Forms applications.
Practice 5b Overview
In this practice, you configure Forms Trace and use it to record information about specific
events. You translate the trace file to XML to view information about triggers that fire and
tab pages that are accessed in a form. You then user Servlet logging to record information
about a Forms run-time session.
a. Define an event set called info that will record information about triggers
and tab pages.
b. Set the logging path for Forms Trace to the directory where ftrace.cfg is
located.
2. Define a named configuration called info where you specify that a Forms Trace
should occur, using the info event set and logging the information to a file called
info.log.
4. In Forms Builder, open the Customers form and click Run Form to run it. Click the
tabs to display all the items in the running form. Exit the form run-time session and
close the browser.
5. Move the trace file to your lab directory and convert it into XML. You can run the
batch file SETCP_xlate.bat to set the CLASSPATH for the translate utility.
6. Examine the XML file to see the triggers that executed and the tab pages that you
clicked in the running form.
7. From Forms Builder, enable Servlet session logging. Click Run Form to run the
Customers form. Shut down OC4J and examine the Servlet log to see what
information is recorded with session logging.
8. To disable Servlet logging, set your preferences back to default. Restart OC4J.
Lesson Aim
This lesson describes the enhanced support in Oracle9i Forms for integrating Java into
your applications.
Client Tier
Enables integration with 1.3 JavaBeans and PJCs
Simpler to integrate Forms and other Applets on
the same page
JInitiator based on 1.3 JDK
Middle Tier
The Java Importer supports use
of JDK 1.2.2 and above.
Enables you to integrate the
latest technologies
Separate JDK installation not needed
JavaBeans
Pluggable Java
Components
FBean Package
Component Description
Spell Checking with Enables text items to utilize the JSpell package from
JSpell 2.0 WallstreetWise; the JSpell software is not supplied with the
Forms demo suite and must be purchased separately if required
File Upload Utility Displays a file selection dialog on the browser machine and
transfers the selected file up to the middle tier
Calendar Enables selection of a date from a calendar widget, without
generating network traffic to display a Forms based calendar
Progress Bar Displays a progress meter
Hyperlink Provides a UI widget that looks and acts like an HTML
hyperlink
Get Client Info Provides information about the client browser machine,
including the Hostname, the IP address, and local O/S
Username; can also obtain the value of any of the Java system
properties on the client
Clock Displays a simple digital clock
Rollover Button Provides an enhanced version of a standard Forms button that
reacts to the mouse hovering over it by changing the displayed
image
Key Filter Customizes a normal text item to prevent unwanted characters
from being entered; filters keystrokes without generating
network traffic to the Application server
Modify Cursor Adds a single custom property to a text item that defines the
name of the mouse cursor that should be shown when the mouse
moves over the field; occurs on the client without any network
round trips when the mouse enters a field
Color Picker Enables client to change color properties of Forms objects by
selecting from a color picker
Info Button Enhances a Forms button so that when the mouse hovers over it,
information displays in a Forms text item that exists at a certain
point on the screen; ideal for menus or interactive help screens
Multi Select T-List Enhanced version of the Forms TList control that allows
multiple selections
Insert Replace Text Enables insert/replace functionality on Forms text items
Fields
In addition to the Forms Demos, you can obtain information on OTN about replacing
Outlook OLE integration with Java Mail and automating Word and Excel from Java.
JavaBeans:
Are components written in Java
Conform to standards
Can be integrated into applications
The Bean Area item enables you to:
Add JavaBean to a form
Extend Forms functionality
Interact with client machine
Reduce network traffic
Methods
Properties
Events
FBean
At design time
FBEAN.REGISTER_BEAN(:CONTROL.hyperlink,1,
At run time
oracle.forms.demos.beans.Hyperlink);
http://otn.oracle.com/products/forms
FBean.Invoke(hHyperlink,1,setURL,
http://otn.oracle.com/products/forms);
FBean.Invoke(hHyperlink,1,setLabel,
Forms on OTN);
1 2 3
event parameters
Responding to Events
When a user interacts with a JavaBean at run time, it usually causes an event to occur.
You can use FBEAN.ENABLE_EVENT to register a listener for the event, so that when
the event occurs, Forms will fire the When-Custom-Item-Event trigger. In this trigger, you
can code a response to the event. The :SYSTEM.CUSTOM_ITEM_EVENT and
:SYSTEM.CUSTOM_EVENT_PARAMETERS variables contain the name of the event
and information the bean is sending to the form.
A typical interaction that could occur includes the following steps:
1. The user clicks the bean area for a hyperlink bean. This bean area has a visible
component on the form consisting of hyperlinked text. The label is set to a
description of the hyperlink destination.
2. The Click event is initiated.
3. The beans listener recognizes the Click event, which automatically fires the When-
Custom-Event trigger.
4. The code in the When-Custom-Item-Event trigger obtains the URL from the
information sent to the form from the event, then invokes the URL.
2
1
51,255,255
4
Summary
You can integrate Oracle9i Forms applications with the latest Java technologies because
JDK 1.3 is used on both the middle and the client tier. You are no longer restricted to Java
code on the middle tier, or JavaBeans and PJCs on the client that were developed with
JDK 1.1.
You can use PJCs as the implementation class for Forms items such as text items, list
items, push buttons, radio groups, or check boxes. Using a PJC to implement these items
changes the functionality and the appearance of the item.
Support for JavaBeans is enhanced in Oracle9i Forms with the introduction of the FBean
package. You can now use JavaBeans without writing a wrapper class, and you can use
heavyweight beans, which was not possible in Forms6i.
The FBean package contains methods to register, invoke, get and set properties, and
enable an event listener on the bean. This makes it easy to code communication with the
bean.
Practice 6 Overview
In this practice, you create bean area items to implement a hyperlink bean and a color
picker bean. You make calls to the FBean package to code interaction with the beans. You
also change the implementation class of a push button to utilize rollover button PJC, and
you implement client-side validation on a text item with a KeyFilter PJC.
Note: The JAR files used in these exercises are available in the Oracle9i Forms
demonstrations, downloadable from OTN.
2. Add code to the Customers form to register the bean at form start-up and to enable
an actionListener.
The class is oracle.forms.demos.beans.Hyperlink (this is case-sensitive).
The bean should be labeled "Forms on OTN" and should invoke the Forms Web
page (http://otn.oracle.com/products/forms).
3. Code the action you want to perform when the user clicks the bean, which is to
invoke the beans URL in a separate browser window. Click Run Form to run the
Form and test the function of the hyperlink..
Hint: You first need to get the URL from the bean, then use
web.show_document to invoke it.
4. In the Customers form, create a bean area in the CONTROL block and name it
Colorpicker. This bean has no visible component on the form, so set it to display as
a tiny dot in the upper left corner of the canvas. Make sure that users cannot
navigate to the bean area item with either the keyboard or mouse.
5. Create a button on the CV_CUSTOMER canvas to enable the user to change the
canvas color using the ColorPicker JavaBean. Place the button just above the Orders
button.
Set the following properties on the button:
Label: Canvas Color Mouse Navigate: No
Keyboard Navigable: No Background color: gray
The button should call a procedure named PickColor, which invokes the bean and
translates the comma-separated color values of the bean to the RGB values used by
PL/SQL. You can import the code from the the pr6_5.pls file in your solutions
directory.
7. Click Run Form to run your form and test the Color button. You should be able to
invoke the ColorPicker bean from the Color button, now that the bean has been
registered at form startup.
8. In the Orders form, use the Rollover Button PJC to change the look of the buttons on
the Toolbar canvas to be rounded buttons. Set the Implementation Class property of
the toolbar buttons (Control block buttons Invoice_Button, Image_Button,
Stock_Button, Show_Help_Button, and Exit_Button) to:
oracle.forms.demos.enhancedItems.RolloverButton.
To implement the rounded button look, surround the label of the buttons with
parentheses, for example, (Invoice). Click Run Form to run the form and test the
changes. At run time, the buttons should have rounded ends as in the following
screenshot:
9. Change the Exit button in the Orders form to be a rollover button by setting its Label
property to [ROLLOVER]exit (note that this is case sensitive and must be typed
exactly as shown). Change the Height and Width properties of the button to 30. Set the
Height of the Toolbar_CV canvas to 40 to accommodate the larger button. Align the
centers of all the toolbar buttons. Click Run Form to run the form and test the changes.
At run time, the buttons should appear as in the following screenshot, and moving the
mouse over the Exit button should change its image.
11. Run the Orders form to test the changes. Try to enter alphabetic characters into the
Order_Items.Quantity item. You should be able to enter only numeric data.
Lesson Aim
This lesson describes the new run-time enhancements for Oracle9i Forms.
2 3 4
Incrementing
value
GET_APPLICATION_PROPERTY(VERSION)
Initially shows
restricted query
2nd Execute_Query
not restricted
Summary
Oracle9i Forms introduces three features to enhance the usability of Forms applications:
The cancelable LOV, implemented by setting the form to non-blocking and setting
the LOV to filter before display
The ability to retrieve the Forms version with the GET_APPLICATION_PROPERTY
built-in
A one time where clause that enables you to restrict a query the first time a query is
executed, but perform subsequent queries that are not restricted
Practice 7 Overview
In this practice, you create a LOV that shows the progress of a long-running record group
query and can be canceled at any point in the record retrieval. You also use
GET_APPLICATION_PROPERTY to retrieve the Forms version number. Finally, you set
up the Orders form so that the first query is restricted to the customer displayed on the
Customers form when Orders is called by the Customers form, but subsequent queries are
not restricted.
2. Create a Control block button on the Customer_CV canvas to display the LOV.
Name the button Long_LOV_Btn, with the Long LOV label. Place the button just to
the left of the Canvas Color button.
3. Click Run Form to run the form. Click Long LOV to invoke the LOV. Enter % in
the Find box so that all records will be retrieved, and click Find. What is the
behavior of the LOV?
4. In the Customers form, set the Interaction Mode property of the form to Non-
Blocking. Run the form again and click Long LOV to invoke the LOV. Enter % in
the Find box so that all records will be retrieved, and click Find. What is the
behavior of the LOV now?
5. In the Orders form, create a Control block button on the Toolbar canvas. Set the
name of the button to About_Btn and its label to About. The code for this button
should display the Forms version in a message. Run the form to test the button.
6. Users of the Customers form are complaining. They click the Orders button, and the
Orders form displays the orders for the customer in the Customers form. However,
after they are in the Orders form, they would like to be able to query orders for other
customers.
To make this possible, change the When-New-Form-Instance trigger in the Orders
form to enable users to execute a second query on the Orders block that is not
restricted to the current Customer_ID from the Customers form. You will also
need to delete or rename the Pre-Query trigger on the Orders block, where the
original functionality is implemented.
Lesson Aim
This lesson presents information to enable you to deploy multinational applications that
account for differences in language, time zone, and character set.
US7ASCII
VARCHAR2(5 CHAR) 1 2 3 4 5
JA16SJIS
VARCHAR2(5 CHAR) 1 2 3 4 5
UTF8
VARCHAR2(5 CHAR) 1 2 3
8-3 Copyright Oracle Corporation, 2002. All rights reserved.
User1 User2
DB1 DB2
DB1 DB2
Forms Listener
Servlet
Booking_en.fmx
fr
Booking_it.fmx
Booking_de.fmx
Forms Runtime
Booking_fr.fmx
Change language
preferences
accept_language=it formsweb.cfg
[booking]
envFile=default.env
en 9iAS HTTP Listener
[booking.it]
envFile=italian.env
[booking.en]
it OC4J envFile=english.env
[booking.french]
de Forms Servlet envFile=fr.env
italian.env
french.env
Forms Listener
Servlet english.env
german.env
fr
italian.env
NLS_LANG=Italian_Italy.
Forms Runtime WE8ISO8859P1
Forms90_PATH =
Booking_it.fmx
Booking_en.fmx
1. Translate the application.
Booking_it.fmx
french.env
english.env 2. Define an environment file
italian.env
NLS_LANG=Italian_Italy.
for each language.
WE8ISO8859P1
Forms90_PATH = ...
... formsweb.cfg
[booking]
envFile=default.env
[booking.it]
3. Define a named configuration envFile=italian.env
for each environment. [booking.en]
envFile=english.env
[booking.fr]
envFile=french.env
Translating an Application
With browser language detection, deploying your translated applications is easy. But how
do you create the translations?
Oracle9iDS introduces a tool called TranslationHub for managing the translation of UI
strings in Forms and Reports applications. This is the same tool that Oracle has used for
several years for translation of Oracle products such as Oracle Applications, so it is
proven technology.
Oracle9i TranslationHub is available only on Windows platforms. It replaces Oracle
Translation Manager and Oracle Translation Builder, which are not supported with
Oracle9i Forms.
Instructor Note
This section presents TranslationHub concepts for the purpose of encouraging its use, but
it is not intended to be a complete tutorial.
The stated objective is that learners should be able to describe the TranslationHub tool,
but not necessarily that they would be able to use it. An eClass on this topic is currently
planned (Oracle9i Forms Developer: Using TranslationHub).
Forms Developer
TranslationHub
Oracle9i Developer Suite iDSv2
Starting TranslationHub
You start the TranslationHub tool from the Windows menu: Start > Programs > Oracle9i
Developer Suite > Forms Developer > TranslationHub
Instructor Note
Demonstration
Open the TranslationHub tool. Customize the user interface to display the Navigator view,
the Attributes view, the Previewer view, and the Output view:
From the TranslationHub menu, choose View, and select the view to display if it is
not already shown.
Resize the views as needed by moving the cursor over a border until it changes to a
Resize pointer, then clicking and dragging the border to the desired position.
Make sure that the Attributes view displays the following columns: Item ID, Base String,
and Translation String.
Right-click one of the column headings in the Attributes view, and select Choose
Columns from the pop-up menu. The Choose Columns window displays.
Check the Item ID, Base String, and Translation String check boxes.
Click OK to close the Choose Columns window.
1 2 3
To translate an application:
1. Construct a translation project
2. Translate the text
3. Build the translated software
1
2
3
Translating Applications
There are three basic steps to translating a Forms application:
1. Construct a translation project.
2. Translate the text.
3. Build the translated software.
Instructor Note
The purpose of this lesson is to introduce students to the capabilities of
TranslationHub, rather than to teach them to use the tool, so there is no formal
demonstration for translating an application.
*HVXQGKHLW
*HVXQGKHLW
Summary
Oracle9i Forms enables you to deploy your application globally in:
Any character set, using character length semantics
Any time zone, with automatic adjustment
Any language, using TranslationHub to translate your application and working with
browser language detection to deploy the correct translation
Character length semantics makes it possible to define Maximum Length or Query Length
without manually adjusting the length for single-byte, multi-byte, or variable-byte
character sets. Forms automatically adjusts the storage allocated for the item.
Summary (continued)
You can implement time zone support in Oracle9i Forms. Forms will automatically adjust
DATETIME items to the client time zone for display on the client, and to a defined
database time zone for insertion into the database.
You set the environment variable FORMS90_DATETIME_SERVER_TZ to specify the
time zone to use for DATETIME items for inserts and updates in the database. Forms uses
a time zone file to perform the conversion, and you specify the location of the file with the
FORMS90_TZFILE environment variable. You can programmatically set the time zone
to use for the client or the database with the SET_APPLICATION_PROPERTY built-in.
Although the time zone conversion is automatic, you can perform it manually if desired
with the ADJUST_TZ built-in.
Summary (continued)
Oracle9i Forms automatically detects the browser language settings on the client running
the application. You can use this feature to deploy applications in different languages
based on the browser setting. You define a named configuration for the application, with
additional configurations of the same name, but with a dot and the two-letter language
abbreviation appended. Each configuration can specify a different environment so that the
application displays in the desired language.
Of course, to deploy applications in different languages, you must first translate the
application into those languages. Oracle9iDS provides the TranslationHub tool to help
you manage such translations.
Practice 8 Overview
In this practice, you implement character length semantics and time zone support for
Forms items. You deploy different applications depending on the language preferences set
in the browser, and you examine the TranslationHub tool.
2. If this form runs with a double-byte character set, how many bytes of storage will
now be allocated for the Orders.Order_Mode item? How many characters will the
user be able to enter into the item?
3. Open the Property Palette for the Orders.Order_Date item and set the following
properties (the X Position and Width should have already been set if the JDAPI
program ModifyOrders ran correctly):
Datatype: Datetime
Maximum Length: 20
Initial value: $$dbdatetime$$
Format Mask: DD-MON-RRRR HH24:MI
Query Length: 25
X Position: 340
Width: 95
Click Run Form to run the Orders form and observe the time displayed in the item.
Click Insert and make note of the initial time displayed in the Order_Date item of a
new record. Choose Record > Clear, and click Exit.
4. Implement time zone support for Forms. Set the database time zone to US/Pacific.
Set the PC's time zone to Eastern Time (US & Canada). Click Run Form to run the
form and test the changes. Observe the time adjustment from the default time of
midnight for existing orders. Insert a new record and observe the time that is
displayed as the initial value. Save the new record and make note of the Order ID.
5. In SQL*Plus, issue a query to retrieve the Order_Date of the record you just entered.
Format the date as DD-MON-YYYY HH24:MI.
7. Change the boilerplate text to read: German version. Create a subdirectory called
DE under your lab directory. Save the form to the DE subdirectory. Generate the
form.
9. Open Internet Explorer. Set the browser language to French. Enter the URL for the
Forms Servlet, with the ?config=langsupport parameter. The unmarked
version of the Orders form should appear.
3. Open the Customers form in Forms Builder. Set the run-time preferences for Forms
Builder to use OC4J to test your applications. Set the Application Server URL by
pressing Set Default which will enter the following settings:
Click Run Form to test. When the applet starts, it should open a separate
browser window to display the application.
Click Exit and close the browser windows.
5. Define a named configuration called [summit] that specifies to run the form
summit.fmx with a page title of Summit Application. You should also specify the
connect string and set the separateFrame parameter to True. You can also add
some HTML parameters, such as a background color
(HTMLbodyAttrs=bgcolor="yellow") and some text to appear before and
after the form (HTMLbeforeForm and HTMLafterForm).
Set the Forms Builder preferences to use the named configuration. Run the form to
test the setting.
Hint: You should stop OC4J before modifying the Forms Web configuration file.
Click Run Form to test that the application appears with the specified
attributes. It will run the Customers form rather than Summit because
Customers is the form that is open and selected in Forms Builder.
Modify the web.xml configuration file for OC4J so that the new Forms Servlet
configuration file (Summit.cfg) is used.
Set your Forms Builder run-time preferences back to the default. Run the form to
test the setting. Do not close the browser because you will need it open for the next
exercise.
Hint: You should stop OC4J before modifying the OC4J configuration file.
Scroll to the end of the file and delete the following lines:
[summit]
form=E:\Labs\SUMMIT.fmx
userid=<userid/password@db>
separateFrame=false
pageTitle=Summit Application
HTMLbodyAttrs=bgcolor="yellow"
HTMLbeforeForm=This is the Summit application:<P>
HTMLafterForm=<P>Thanks for using this application!
In the main part of the file, edit the default values for form, userid,
separateFrame, pageTitle, HTMLbodyAttrs bgcolor,
HTMLbeforeForm, and HTMLafterForm to be the same as those previously
defined in the named [summit] portion of the file.
Click Run Form to test that the application appears with the specified
attributes. It will run the Customers form rather than Summit because
Customers is the form that is open and selected in Forms Builder.
Exit the form, but leave the browser open for the next exercise.
7. Edit the URL in the browser by deleting all parameters. Open the new URL.
Edit the URL: Delete the "?" and everything to the right of it. The URL should
now be: http://<machine name>:8888/forms90/f90servlet. Run
the URL (click Go or press Enter).
The Forms Servlet should now use all the default values specified in
Summit.cfg, so it should run the Summit form.
Shut down OC4J. In web.xml, add back the comments as they were originally
(<! at the beginning and --> at the end) to the section that specifies
configFileName.
9. From Forms Builder, run the Customers form normally. Click Orders. The Orders
form should appear. Exit the forms and the browser.
No formal solution.
10. Move the Orders form (Orders.fmx) from the lab directory to a temporary directory,
such as e:\temp. You can first create this directory if it does not already exist.
From Forms Builder, run the Customers form again and click Orders. What happens
and why? Exit the Customers form and the browser.
___________________________________________________________________
___________________________________________________________________
You receive the error FRM-40010 Cannot read form orders. This is
because the .fmx file is no longer in the path (FORMS90_PATH) that Forms
Runtime searches to locate needed files.
Now when you run Customers from Forms Builder and click Orders, Forms
should successfully locate and run the Orders.fmx file.
4. If you run the migration utility on the Summit form without specifying a log file
name, a log file called converter.log is generated. Change the default log file
name to my_log.log. Run the utility on the Summit form without specifying a
log file name, as you did in 1b but without the log= parameter. Then check to see
what log file is created.
No formal solution.
The upgrade process has attached the library RP2RRO to the form module and
has created a report object called RP2RRO. It has also added eleven
parameters.
3. With the Orders form selected in the Forms Builder Object Navigator, click Run
Form to run the Orders form. Click Invoice. If you receive FRM-40735 and ORA-
6508 errors or an ORA-907 error, this might indicate that the library needs to be
compiled. Compile the RP2RRO library, save it, then run the form again.
Instructor Note
This practice uses the Reports Server to run reports. Students will use the Reports
Server on the instructor machine. If you have not already done so, you will need to
start the Reports Server on your machine by running the batch file RepSRV.bat,
located in your demo directory.
4. Convert the code in the Invoice button of the Orders form to use a direct call to
RUN_REPORT_OBJECT. A message appears when the report is completed. Use the
report object that was created by the Migration Assistant. Detach the RP2RRO
library from the form and delete all the parameters. Run the form from Forms
Builder to test your changes.
declare
v_repid REPORT_OBJECT;
vc_rep VARCHAR2(20);
vc_rep_status VARCHAR2(20);
BEGIN
v_repid := FIND_REPORT_OBJECT(RP2RRO);
SET_REPORT_OBJECT_PROPERTY(v_repid,REPORT_FILENAME,
order_invoice);
SET_REPORT_OBJECT_PROPERTY(v_repid, REPORT_OTHER,
porder_id= || :orders.order_id);
vc_rep := RUN_REPORT_OBJECT(v_repid);
vc_rep_status := REPORT_OBJECT_STATUS(vc_rep);
WHILE vc_rep_status in (RUNNING, OPENING_REPORT,
ENQUEUED) LOOP
vc_rep_status := report_object_status(vc_rep);
END LOOP;
if vc_rep_status = FINISHED then
message(Report Completed);
else
message(Error when running report.);
end if;
END;
5. Add code to the When-Button-Pressed trigger for the Invoice button to display the
completed report. The name of the Reports Server that you will use is RepSRV.
Run the report by clicking Run Form, then clicking Invoice when the form is
displayed. The report should appear in a separate browser window.
Add the following right after the message in the first part of the IF statement:
vc_URL := /reports/rwservlet/getjobid
||substr(vc_rep,8)||?server=RepSRV;
Web.show_document(vc_URL);
Open Windows Explorer. Open the Labs directory. Right-click the file
javadocJDAPIXML.zip and from the pop-up menu choose the option
Extract to folder \Labs\javadocJDAPIXML.
3. Use the javadoc for JDAPI to answer the following questions, then close the javadoc
browser window:
a. What class would you use to access an Attached Library in a Forms module?
_______________________________________________________________
Click the link for the oracle.forms.jdapi package and scroll down to the
Class Summary section of the documentation for that package. You will
see that the class name is AttachedLibrary.
b. What method of that class would you use to find out the location of the
library?
______________________________________________________________
Click the link for the AttachedLibrary. Scroll to the Method Summary
section of the documentation for that class. Scroll through the "get"
methods; you will find the method getLibraryLocation.
______________________________________________________________
The left column of the Method Summary is the return data type, which in
this case is java.lang.String.
import oracle.forms.jdapi.*;
public class ModifyOrders
{
public static void main(String[] args)
{
FormModule fmd = FormModule.open("Orders.fmb");
int xPos = 340; int itemWidth = 95;
JdapiIterator blocks = fmd.getBlocks();
while(blocks.hasNext())
{
Block myBlock = (Block)blocks.next();
if (myBlock.getName().equals("ORDERS"))
{
JdapiIterator items = myBlock.getItems();
while(items.hasNext())
{
Item myItem = (Item)items.next();
if (myItem.getName().equals("ORDER_DATE"))
{
myItem.setXPosition(xPos);
myItem.setWidth(itemWidth);
}}}}
fmd.save("Orders.fmb");
Jdapi.connectToDatabase("ora1/oracle@iasdb");
fmd.compile();
Jdapi.disconnectFromDatabase();
fmd.destroy();
Jdapi.shutdown();
}}
6. Check to see that the Orders form compiled successfully. If an Orders.err file was
created, open it to examine the output. Open the Orders form in Forms Builder to
ensure that the X position and Width properties of Orders.Order_Items have been
modified. Then close all forms in Forms Builder.
No formal solution.
Open a DOS window and navigate to the labs directory. To perform the XML
conversion, do one of the following two choices:
2. In the XML file, change the background color of the Account_Mgr_Name item to
red and the foreground color of that item to white.
4. Using the convenience script, convert the XML file back to a .fmb, then open the
form in Forms Builder and run it to test the change. Then close the form in Forms
Builder.
Hint: You will need to connect to the database when you convert this XML to a
.fmb.
Open the Customers form in Forms Builder. Examine the properties of the
Account_Mgr_Name item to see that the background color is now red. Run the
form and navigate to the Account Information tab to see that the Account
Manager Name item now has a red background and its text appears as white.
Notice that the prompt for the item also appears as white.
In the DOS window, run the convenience script to convert the .xml to a .fmb:
ifxml2f90 overwrite=yes userid=ora1/oracle@iasdb
customers_fmb.xml
Open the Customers form in Forms Builder. Click Run Form and navigate to
the Account Information tab. The prompt for the Account Manager Name
should now be black, while the foreground color (text color) in the item itself
remains white.
You can change these colors back to their default values by deleting the entire
attribute from the item in the .xml file. Then, convert the .xml file to a .fmb,
open it in Forms Builder, and you will see that the values for these attributes
have been set back to <Unspecified> (the default).
7. Create an error in the customers_fmb.xml file by deleting any of the end tags.
For example, delete the final ">" in the section for one of the items. Then validate
the XML to see the errors that appear.
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
Forms XML Conversion Utilities use an internal Forms Schema to validate and
parse XML. You would need to generate an external Forms Schema file only if
you are using your own XML software or parser; in this case, the Schema
Generator produces a forms90.xsd file that can be used with such software.
9. Create a file that represents the Forms Schema. Open that file (forms90.xsd) in
WordPad to examine the structure of the Forms Schema, consisting of all the
possible tags that can be used for Forms elements and attributes. Examine the
attributes defined for the Item element. You should see the attributes that you
modified in earlier exercises.
This creates a file called forms90.xsd. Open this file in WordPad. Notice that
the top portion of the file lists all the elements that can be defined in a Form.
Below the list of elements is a list of complex types to provide further details
about the structure of the elements. To view the details about the Item element,
search the file for <complexType name="Item"> .
Look at the list of attributes for the Item element. You should see listed the
attributes that you modified in the customer_fmb.xml file for the
Account_Mgr_Name item: BackColor, ForegroundColor, and
PromptForegroundColor.
When-Button-Pressed on CONTROL.Account_Mgr_LOV_Button:
LIST_OF_VALUES(ACCOUNT_MGR_LO, Account Manager);
2. Click Run Form to run the Customer form. Select the Account Information tab.
Click the LOV button that is to the right of the Account Manager ID. Notice that the
LOV does not appear, and you receive a message that You have just cancelled the
List of Values. Exit the run-time form and close the browser window.
No formal solution.
3. Click Run Form Debug to run the form in debug mode. In Forms Builder, set a
breakpoint in your When-Button-Pressed trigger for the
CONTROL.Account_Mgr_LOV_Button. In the running form, click the Account
Manager LOV button to invoke the debugger. Investigate the call stack. Try
stepping through the code to monitor its progress. Look at the Variables panel to see
the value of the parameters you passed to the procedure, and the value of the p_lov
variable in the procedure. How would this information help you to figure out where
the code was in error?
Hint: You may need to resize the PL/SQL Editor window to see the Debug Console.
In the running form, select the Account Information tab and click the
Account_Mgr_LOV_Button. The debugger takes control of the form because
the breakpoint is encountered. The running form now appears as a blank
applet.
In Forms Builder, the Debug Console is displayed. If the Stack panel and the
Variables panel are not shown, click the appropriate icons of the Debug
Console window to display them.
In the Forms Builder toolbar, click Step Into. This adds the List_Of_Values
procedure to the Stack panel. In addition, some variables now appear in the
Variables panel.
Resize the Value column of the Variables panel so that you can see the entire
value of the variables. You can see that the p_lov value is incorrect, because as
the developer of the application you know that the list of values is named
ACCOUNT_MGR_LOV, not ACCOUNT_MGR_LO.
Having discovered the problem, you can click Go in the Forms Builder toolbar
to execute the remaining code. Control returns to the running form.
In Forms Builder, click Stop to dismiss the debugger and exit the form. Close
the browser window.
Correct the code in the When-Button-Pressed trigger. You can then run the
form again to retest it.
4. Add a button to the Control block of the Orders form. Place the button on the
CV_Order canvas. Set properties as follows (note that the Icon Filename property is
case sensitive):
Property Value
Name Check_Total_Button
Iconic Yes
Icon Filename check
Keyboard Navigable No
Mouse Navigate No
X Position 295
Y Position 220
Height 17
Width 17
The function of this button is to recheck the Order Total. Write a When-Button-
Pressed Trigger to loop through the records in the Order_Items block and
accumulate the calculated total (price * quantity) in a numeric variable. You should
intentionally make an error when initializing this variable (the intent is to initialize it
to zero, but you type 9 "by mistake").
You can import the code for the trigger from pr5a_4.pls in your solutions
directory.
Run the form, click the Check_Total_Button, and notice that the results are off by
$9.00 when compared with the calculated item labeled Order Total.
Run the form in Debug mode and click the button. When the Debug Console is
invoked, Look at the variable value in the Variables panel of the Debug Console.
As soon as the variable is initialized at 9, change the value of the variable to zero in
the Variables panel of the Debug Console before stepping into subsequent code.
The code should use the corrected value and the correct result should be displayed
on the message line. This indicates that the variable initialization is what should be
corrected in the code.
Stop the debug session. Correct the code and run the form normally to test.
6. Sales representative Janette King is using a query form to find out what
commissions she has earned. She calls the Help Desk because the form is under
calculating her commissions. Pair up with someone using another PC. Designate one
PC as the Help Desk PC and the other as Janettes PC. Perform the following:
C. The problem with the form is that the PL/SQL package variable
vn_emp_comm is set when the package is first instantiated. This variable was
set to the commission percent for the employee displayed the very first time
Janette clicked Calculate Commission. In order for the value to change with
each execution of the package, the variable should be set in the package body,
not the package specification.
D. Open the PL/SQL Editor for the package specification and change the variable
declaration for vn_emp_comm to initialize the value to 0.
E. Open package body and add the following line right after the BEGIN
statement:
vn_emp_comm := :employees.commission_pct;
F. Generate the form by pressing [Ctrl-T].
Janettes PC:
A. Edit the URL in the browser to delete &debug and the host and port
information at the end of the URL. Run the form again by pressing Enter.
B. Test that the problem has been fixed by pressing Calculate Commission for the
first employee that appears, and again for Janette King. Verify that Janettes
commission is now calculated correctly.
a. Define an event set called info that will record information about triggers
and tabbed pages.
b. Set the logging path for Forms Trace to the directory where ftrace.cfg is
located.
2. Define a named configuration called info where you specify that a Forms Trace
should occur, using the info event set and logging the information to a file called
info.log.
4. In Forms Builder, open the Customers form and click Run Form to run it. Click the
tabs to display all the items in the running form. Exit the form run-time session and
close the browser.
No formal solution.
6. Examine the XML file to see the triggers that executed and the tabbed pages that
you clicked in the running form.
7. From Forms Builder, enable Servlet session logging. Click Run Form to run the
Customers form. Shut down OC4J and examine the Servlet log to see what
information is recorded with session logging.
In the Forms Builder menu, choose Edit > Preferences, and click the Runtime
tab.
Modify the Application Server URL:
Delete the ?config=info parameter
Append the following:
?serverURL=/forms90/l90servlet/session
Click OK.
With the Customers form selected in the Object Navigator, click Run Form.
When the form appears, exit the form.
Shut down OC4J by double-clicking the shortcut to stopinst.bat.
In WordPad, open the file
<iDS_HOME>\j2ee\Oracle9iDS\application-deployments\
forms\application.log.
Scroll to the end of the file to view the server name, client IP address, and
process ID for the Forms Runtime process.
Oracle9i Forms Developer: New Features A-26
Practice 5b Solutions (continued)
8. To disable Servlet logging, set your preferences back to default. Restart OC4J.
In the Forms Builder menu, choose Edit > Preferences, and click the Runtime
tab. Click Set Default.
Start OC4J by double-clicking the shortcut to startinst.bat.
Double-click the bean area to invoke its Property Palette. Set the Name
property to HYPERLINK. Set the Bevel property to None. Set the Background
Color property to a color of your choosing. Copy to the clipboard the value of
the Background Color.
Right-click a blank area of the canvas and select Property Palette from the pop-
up menu. In the Property Palette for the canvas, set the Background Color to be
the same as the one you chose for the Bean Area by pasting the copied value.
2. Add code to the Customers form to register the bean at form start-up and to enable
an actionListener. The class is oracle.forms.demos.beans.Hyperlink (this is
case-sensitive). The bean should be labeled "Forms on OTN" and should invoke the
Forms Web page (http://otn.oracle.com/products/forms).
Display the Layout Editor and make sure that the block is set to CONTROL.
Select the Bean Area tool and drag out a bean area on the canvas.
Set the NAME to COLORPICKER.
Set X Position and Y Position to 0.
Set Width and Height to 1.
Set Keyboard Navigable and Mouse Navigate to No.
5. Create a button on the CV_CUSTOMER canvas to enable the user to change the
canvas color using the ColorPicker JavaBean. Place the button just above the Orders
button.
Set the following properties on the button:
Label: Canvas Color Mouse Navigate: No
Keyboard Navigable: No Background color: gray
The button should call a procedure named PickColor, which invokes the bean and
translates the comma-separated color values of the bean to the RGB values used by
PL/SQL. You can import the code from the the pr6_5.pls file in your solutions
directory.
7. Click Run Form to run your form and test the Color button. You should be able to
invoke the ColorPicker bean from the Color button, now that the bean has been
registered at form startup.
No formal solution.
8. In the Orders form, use the Rollover Button PJC to change the look of the buttons on
the Toolbar canvas to be rounded buttons. Set the Implementation Class property of
the toolbar buttons (Control block buttons Invoice_Button, Image_Button,
Stock_Button, Show_Help_Button, and Exit_Button) to:
oracle.forms.demos.enhancedItems.RolloverButton.
To implement the rounded button look, surround the label of the buttons with
parentheses, for example, (Invoice). Click Run Form to run the form and test the
changes. At run time, the buttons should have rounded ends like the following
screenshot:
No formal solution.
No formal solution.
Open the Property Palette for the :ORDER_ITEMS.Quantity item. Set the
Implementation Class property to: oracle.forms.demos.KeyFilter
11. Run the Orders for to test the changes. Try to enter alphabetic characters into the
Order_Items.Quantity item. You should be able to enter only numeric data.
No formal solution.
In the Object Navigator, select LOVs and click Create. The New LOV window
appears. Click OK to use the LOV Wizard.
In the LOV Wizard, click Next to display the Record Group definition window.
Click Import SQL Query, and select pr8_1.sql from the soln directory.
Click Next.
Click >> to use both columns. Click Next twice to display the Window definition
window.
Give the LOV a title of Cartesian LOV. Click Finish.
In the Object Navigator, rename the LOV and the Record Group to
Cartesian_LOV and Cartesian_RG.
Open the Property Palette for the LOV. Set the Filter Before Display property
to Yes. Set the Height property to 200.
2. Create a Control block button on the Customer_CV canvas to display the LOV.
Name the button Long_LOV_Btn, with the label Long LOV. Place the button just to
the left of the Canvas Color button.
The LOV returns all records. If you click Cancel because it is taking an
excessive amount of time, the LOV still returns all the records before it is
canceled. There is no feedback to the user about the process that is occurring,
so the user may think that the application is hanging.
4. In the Customers form, set the Interaction Mode property of the form to Non-
Blocking. Run the form again and click Long LOV to invoke the LOV. Enter % in
the Find box so that all records will be retrieved, and click Find. What is the
behavior of the LOV now?
After an initial pause, the LOV displays a message telling the user the number
of records being retrieved. Because this number is constantly updated, the user
realizes that processing is occurring and that the application is not hanging. If
the user clicks Cancel, record retrieval stops and the user can work with the set
of records that has been retrieved to that point.
5. In the Orders form, create a Control block button on the Toolbar canvas. Set the
name of the button to About_Btn, its label to (About), and its implementation class
to oracle.forms.demos.enhancedItems.RolloverButton. The code
for this button should display the Forms version in a message. Run the form to test
the button.
With the Customers form selected in the Object Navigator, click Run Form.
In the Customers form, click Orders. The Orders form should initially display
orders only for the customer whose record is displayed in the Customers form.
In the Orders form, press Execute Query. All orders should now be displayed.
2. If this form runs with a double-byte character set, how many bytes of storage will
now be allocated for the Orders.Order_Mode item? How many characters will the
user be able to enter into the item? Change Orders.Order_Mode back to a check
box when you are finished answering the question.
3. Open the Property Palette for the Orders.Order_Date item and set the following
properties (the X Position and Width should have already been set if the JDAPI
program ModifyOrders ran correctly):
Datatype: Datetime
Maximum Length: 20
Initial value: $$dbdatetime$$
Format Mask: DD-MON-RRRR HH24:MI
Query Length: 25
X Position: 340
Width: 95
Click Run Form to run the Orders form and observe the time displayed in the
item. Click Insert and make note of the initial time displayed in the Order_Date
item of a new record. Choose Record > Clear, and click Exit.
No formal solution.
Set the PCs time zone to (GMT-5:00) Eastern Time (US & Canada):
Double-click the time displayed in the lower right corner of the Task Bar on
your PC desktop. The Date/Time Properties window appears. Click the Time
Zone tab.
If you have permission to change the browser settings, select from the drop-
down list:
(GMT-5:00) Eastern Time (US & Canada)
If you are not able to change the browser settings, you can add the
environment variable FORMS90_DATETIME_LOCAL_TZ to the
default.env file: FORMS90_DATETIME_LOCAL_TZ=US/Eastern
You should see that the record was saved to the database with the time in the
database time zone, 3 hours earlier than the time that appeared in your
browser. Note that it does not matter where the database is actually located;
it could be in any time zone, but the date is saved in the time zone defined by
FORMS90_DATETIME_SERVER_TZ in the default.env file.
6. Add boilerplate text to the Orders form to identify it as the English version of the
form. Create a subdirectory called EN under your lab directory. Save the form to
the EN subdirectory. Generate the form.
No formal solution.
7. Change the boilerplate text to read: German version. Create a subdirectory called
DE under your lab directory. Save the form to the DE subdirectory. Generate the
form.
In WordPad, open formsweb.cfg. Scroll to the bottom of the file and add the
following lines:
[langsupport]
form=<lab directory>\orders.fmx
[langsupport.en-us]
form=<lab directory>\en\orders.fmx
[langsupport.de]
form=<lab directory>\de\orders.fmx
(where <lab directory> is the path to your lab directory.
No formal solution.
7. Change the boilerplate text to read: German version. Save the form to the DE
subdirectory of your lab directory. Generate the form.
In WordPad, open formsweb.cfg. Scroll to the bottom of the file and add the
following lines:
[langsupport]
form=<lab directory>\orders.fmx
[langsupport.en-us]
form=<lab directory>\en\orders.fmx
[langsupport.de]
form=<lab directory>\de\orders.fmx
(where <lab directory> is the path to your lab directory.
9. Open Internet Explorer. Set the browser language to French. Enter the URL for
the Forms Servlet, with the ?config=langsupport parameter. The
unmarked version of the Orders form should appear.
To set the browser language in Internet Explorer, select Tools > Internet
Options from the menu. The Internet Options window appears. Click
Languages. The Language Preference window appears. If the French
(France) [fr] language is not listed, add it by clicking Add and selecting
it from the Add Language window, then click OK.
No formal solution.
No formal solution.
Appendix Aim
This appendix describes how to leverage the Oracle Enterprise Manager and Oracle
Internet Directory components of Oracle9i Application Server to manage Forms Services
and to enable single sign-on.
4 5 6
Secure?
Oracle 9iAS
Forms Servlet 5
2
Oracle9i
3 Oracle9i Single 4 Internet
SignOn Server
Directory
Oracle 9iAS
Forms Runtime Engine
Oracle HTTP Server
1
powered by Apache
2
mod_osso Oracle9i DB
Forms Listener Servlet
Forms Servlet
3
Oracle9i
Oracle9i Single
Internet
SignOn Server
Directory
powered by Apache
IMGR8T
4 mod_osso Oracle9i DB
Forms Listener Servlet
Forms Servlet
5 Oracle9i
Oracle9i Single
Internet
SignOn Server
Directory
Oracle 9iAS
Forms Runtime Engine
Oracle HTTP Server
powered by Apache
mod_osso Oracle9i DB
Forms Listener Servlet
Forms Servlet
6
Oracle9i
Oracle9i Single
Internet
SignOn Server
Directory
Oracle 9iAS
Forms Runtime Engine
Oracle HTTP Server
powered by Apache
mod_osso Oracle9i DB
Forms Listener Servlet
Forms Servlet
7
Oracle9i
Oracle9i Single
Internet
SignOn Server
Directory
Oracle 9iAS
Forms Runtime Engine
Oracle HTTP Server
powered by Apache
mod_osso Oracle9i DB
Forms Listener Servlet
Forms Servlet
8
Oracle9i
Oracle9i Single
Internet
SignOn Server
Directory
Oracle 9iAS 10
Forms Runtime Engine
Oracle HTTP Server
powered by Apache 9 Oracle9i DB
mod_osso
Forms Listener Servlet
Forms Servlet
Oracle9i
Oracle9i Single
Internet
SignOn Server
Directory
Setting Up SSO
To use single sign-on with Forms applications, you perform the following steps:
1. Register the application with mod_osso: To SSO secure an application in
Oracle9iAS, the application URL must be registered with mod_osso. Note that the
SSO configuration is not the default when installing Oracle9i Forms Services. You
must add the URL to the forms90.conf file that is located in the
forms90/server directory. You do this by uncommenting the last entries in the
file. You must stop and restart the 9iAS instance for the new setting to take effect.
In this release, mod_osso registers the root URL, not providing a separate handling
for added query parameters (this feature will be implemented in a future patch set).
For Oracle9i Forms, protecting the static root URL means that the URL
http://hostname:port/forms90/f90servlet is protected by
mod_osso. All Forms applications started with this URL, no matter what parameters
are added, are protected by mod_osso.
Note: According to Oracle9i Forms Developer and Forms Services Release Notes
Addendum, you cannot run forms in both HTTP and HTTPS mode simultaneously
when using SSO, because you can register only one or the other with mod_osso.
--formsweb.cfg
.... Oracle9i
.... 9iDB
Internet
[faq] Directory connect string:
form=faq.fmx frankie/johnnie@9idb
URL: http://host:port/forms90/f90servlet?config=faq
formsweb.cfg
....
[hr_app]
form=hr.fmx
[order_entry]
form=orders.fmx
[expense]
form=
expense_report.fmx
Summary
Oracle Enterprise Manager: Provides a Web site where you can manage and view
information about Forms Services.
Oracle Internet Directory and Single-Sign-on Server: Enables you to implement
single sign-on for Forms applications without changing application code.
Appendix Aim
This appendix explains how integration with Oracle9i Software Configuration Manager
enables source code control of Forms applications.
Oracle9i SCM
Repository
Upload
Download
File >
Administration
Check In
Check Out
Source
Control
Options
Change repository
connection
Select container
Checking In a File
To check in a file:
The file that you want to check in must be selected in Forms Builder.
Save your changes to the file system.
Select the File | Administration | Check In.
If prompted, log into SCM. Forms Builder will connect with SCM, establish the
work area and folder, and upload the source file from the file system.
If the file already exists in SCM, an alert is displayed. Select whether to overwrite
the file in SCM. (If the file was never checked out, the operation will fail.)
After the file is uploaded, select any checkin options:
- Use Branch
- Version Label (This is available for editing only if automatic version labeling
switched off.)
- Use Checkout Notes
- Check Out after Check In
- Check in Even if Unchanged
Enter any checkin notes. At this point, you can cancel the checkin, if necessary.
Click OK. The checkin is complete, and the source file is set to Read-Only.
User 1 User 2
Summary
Oracle9i Software Configuration Manager is a component of Oracle9i Developer Suite. It
enables source control for team development of applications, using a repository in the
Oracle9i database. The SCM administrator can specify that the repository should be used
as source control for Forms and Reports applications.
Only after Forms developers have been set up as SCM users, can they, in Forms Builder,
select the SCM work area and folder to use for source control. They can check modules
out of the SCM repository and load them into Forms Builder, which synchronizes the file
with the developers file system and enables them to make changes to the file. When they
save the changes, they can check the module back in to the SCM repository, thus
synchronizing the latest file system file with the SCM repository. After it is checked in,
the file system file has a read-only attribute.
When developers check out modules from SCM, they should close the module in Forms
Builder and reopen it to ensure that they are working with the latest version of the module.
They should also save changes before checking a module back in. This is because
checking a module in or out synchronizes the repository with the file system, but does not
synchronize with the module loaded in Forms Builder.
ORDER_ID ORDER_ID
ORDER_ITEMS ORDERS
PRODUCT_ID SALES_REP_ID CUSTOMER_ID
CUSTOMER_ID
*
INVENTORIES CUSTOMERS
PRODUCT_ID ACCOUNT_MGR_ID
PRODUCTS EMPLOYEES
DEPARTMENT_ID
DEPARTMENT_ID
DEPARTMENTS