You are on page 1of 440

Oracle Designer 6i: Web PL/

SQL Design and Generation


Volume 1 • Instructor Guide
...........................................................................................

Course Code: 20007GC10


Prod:1.0
Date: Sep 2000
M012919

®
Authors Copyright  Oracle Corporation, 1998, 1999, 2000. All rights reserved.

This documentation contains proprietary information of Oracle Corporation. It is


Gillian Channer
provided under a license agreement containing restrictions on use and disclosure
Shena Deuchars and is also protected by copyright law. Reverse engineering of the software is
prohibited. 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 applicable:

Technical Contributors
Restricted Rights Legend
and Reviewers
Use, duplication or disclosure by the Government is subject to restrictions for
Jeffrey Gallus commercial computer software and shall be deemed to be Restricted Rights
software under Federal law, as set forth in subparagraph (c) (1) (ii) of DFARS
Satyajit Ranganathan 252.227-7013, Rights in Technical Data and Computer Software (October 1988).
Gerard Sugrue
This material or any portion of it may not be copied in any form or by any means
without the express prior written permission of the Worldwide Education Services
group of Oracle Corporation. Any other copying is a violation of copyright law and
may result in civil and/or criminal penalties.
Publishers
If this documentation is delivered to a U.S. Government Agency not within the
Fiona Simpson Department of Defense, then it is delivered with “Restricted Right,” as defined in
FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987).
Carol Brown
Don Griffin 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, Oracle Corporation, 500 Oracle Parkway, Box 659806, Redwood
Shores, CA 94065. Oracle Corporation does not warrant that this document is
error-free.

Oracle, SQL*Plus, SQL*Net, Oracle Developer, Oracle7, Oracle8, Oracle


Designer and PL/SQL are trademarks or registered trademarks of Oracle
Corporation.

All other products or company names are used for identification purposes only,
and may be trademarks of their respective owners.
Contents
..........................................................................................................................................

Contents
Lesson 1: Introduction
Introduction 1-2
How to Learn About Oracle Designer 1-4
The Oracle Designer Curriculum 1-5
System Building 1-7
System Development 1-9
What are the Components for Web PL/SQL Generation? 1-10
Three-Tier Architecture 1-11
Where Does the Web PL/SQL Generator Fit In? 1-12
What About Web Forms? 1-13
Course Agenda 1-15
Applications for the Course 1-17
Practice 1—1: Browsing a Generated Application 1-18
Hints 1-20
Instructor Notes 1-21
Instructor Post Lesson Teaching Evaluation 1-29
Suggested Graphics 1-31

Lesson 2: Generating Web PL/SQL Modules


Introduction 2-2
Setting Web PL/SQL Generator Options 2-4
Generating a Module 2-6
The Generate Web PL/SQL Dialog 2-7
Inputs to the Generator 2-8
Outputs from the Generator 2-9
Installing the Generated PL/SQL 2-10
Running a Module 2-11
Understanding the Module Structure 2-13
Making Module Components Reusable 2-15
Summary 2-16
Practice 2—1: Generating a Simple Module 2-17
Practice 2—2: Installing and Running a Simple Module 2-18
Practice 2—3: Exploring the Module Structure 2-19
Practice 2—4: Making a Module Component Reusable 2-20
Hints 2-21

..........................................................................................................................................
®
iii
Contents
..........................................................................................................................................

Instructor Notes 2-23


Instructor Post Lesson Teaching Evaluation 2-27
Suggested Graphics 2-29

Lesson 3: Setting Up the Generation Environment


Introduction 3-2
Preparing for Generation 3-4
Investigating the Web PL/SQL Toolkit 3-5
Using the Web PL/SQL Generator Library 3-7
Understanding the Table API 3-9
Building and Generating the Table API 3-11
Pre-Generation Check List 3-13
Summary 3-14
Practice 3—1: Generating the Table API 3-15
Practice 3—2: Investigating the Web PL/SQL Toolkit 3-16
Practice 3—3: Investigating the Generated Code 3-17
Hints 3-18
Instructor Notes 3-19
Instructor Post Lesson Teaching Evaluation 3-25
Suggested Graphics 3-27

Lesson 4: Designing Web PL/SQL Modules


Introduction 4-2
Preparing for Module Design 4-4
Establishing Display Standards 4-5
Creating Modules 4-7
Using the Application Design Transformer 4-8
Linking Table Usages in a Module Manually 4-9
Using the Default Links Utility 4-11
Creating a Module Semi-Automatically 4-13
Creating a Module Manually 4-15
Universal Generation 4-18
Creating a Web Module from a Form 4-19
Summary 4-20
Practice 4—1: Creating a Web Module Using the Semi-Automatic Method
4-21
Practice 4—2: Creating a Web Module Manually 4-23

..........................................................................................................................................
iv Oracle Designer 6i: Web PL/SQL Design and Generation
Contents
..........................................................................................................................................

Practice 4—3: Creating a Web Module from a Captured Form 4-25


Hints 4-28
Instructor Notes 4-31
Instructor Post Lesson Teaching Evaluation 4-37
Suggested Graphics 4-39

Lesson 5: Changing the User Interface


Introduction 5-2
Review of the Module Structure 5-4
Module Pages 5-5
Module Component Pages: Query Form 5-7
Module Component Pages: Record List 5-8
Module Component Pages: View Form 5-10
Module Component Pages: Insert Form 5-12
Item Layout Styles 5-13
Module Component Display Styles 5-14
Removing Duplicate Data from a Record List 5-17
Summarizing Data on a Record List 5-19
Summary 5-21
Practice 5—1: Adding Descriptive Information 5-22
Practice 5—2: Changing the Item Layout Style 5-23
Practice 5—3: Altering Module Component Display Styles 5-24
Practice 5—4: Summarizing Data on a Record List 5-25
Hints 5-27
Instructor Notes 5-30
Instructor Post Lesson Teaching Evaluation 5-35
Suggested Graphics 5-37

Lesson 6: Implementing User Interface Standards


Introduction 6-2
Adding User Text 6-4
Using HTML in User Text 6-7
Using the Toolkit in User Text 6-9
Using Custom Functions in User Text 6-10
Accessing Images 6-11
Formatting Column Values 6-12
Adding Standard Headers and Footers to Applications 6-14

..........................................................................................................................................
®
v
Contents
..........................................................................................................................................

Setting the Default Colors 6-15


Creating a Document Template 6-16
Mapping Document Templates to Generated Pages 6-19
Creating a Frameset 6-20
Invoking a Custom Frameset 6-24
Summary 6-26
Practice 6—1: Adding Static Text and Images 6-28
Practice 6—2: Adding Standard Headers and Footers 6-30
Practice 6—3: Formatting Column Values 6-32
Practice 6—4: Using a Style Sheet 6-33
Practice 6—5: Creating a Custom Frameset 6-35
Hints 6-37
Instructor Notes 6-40
Instructor Post Lesson Teaching Evaluation 6-47
Suggested Graphics 6-49

Lesson 7: Building More Complex Modules


Introduction 7-2
Placing the Detail Record List 7-4
Providing Master Context Information 7-8
Lists of Values 7-10
Adding a List of Values to a Module 7-12
Refining a List of Values 7-15
Controlling the Display of Lists of Values 7-19
Updating and Inserting Multiple Records 7-20
Controlling User Input 7-22
Summary 7-25
Practice 7—1: Examining a Master–Detail Module 7-26
Practice 7—2: Reducing Pages in a Master–Detail Module 7-27
Practice 7—3: Adding Contextual Information 7-29
Practice 7—4: Adding Lists of Values 7-30
Practice 7—5: Creating Multiple Row Insert Pages 7-32
Practice 7—6: Using Default Values and Calendars 7-33
Hints 7-35
Instructor Notes 7-37
Instructor Post Lesson Teaching Evaluation 7-43

..........................................................................................................................................
vi Oracle Designer 6i: Web PL/SQL Design and Generation
Contents
..........................................................................................................................................

Suggested Graphics 7-45

Lesson 8: Defining Application Logic in the Repository


Introduction 8-2
Understanding Application Logic 8-4
Events 8-6
Defining an Event Code Segment 8-11
Using the Logic Editor 8-12
Named Routines 8-14
Defining Custom Items 8-17
Deriving a Value from an SQL Expression 8-18
Deriving a Value from a Function 8-20
Embedding Java in a Web PL/SQL Application 8-22
Summary 8-27
Practice 8—1: Adding Client-Side Event Code 8-28
Practice 8—2: Adding Server-Side Named Routines and Events 8-30
Practice 8—3: Populating an Unbound Item 8-31
Hints 8-32
Instructor Notes 8-34
Instructor Post Lesson Teaching Evaluation 8-39
Suggested Graphics 8-41

Lesson 9: Security and Web PL/SQL Applications


Introduction 9-2
Security Issues 9-3
Restricting Data Access 9-4
Approaches to Security in the Server 9-7
Implementing Security Using Packages 9-10
Summary 9-14
Practice 9—1: Arguments and Web PL/SQL Modules 9-16
Practice 9—2: Implementing Self-Service Security 9-18
Hints 9-19
Instructor Notes 9-20
Instructor Post Lesson Teaching Evaluation 9-25
Suggested Graphics 9-27

..........................................................................................................................................
®
vii
Contents
..........................................................................................................................................

Lesson 10: Completing Your Application


Introduction 10-2
Web PL/SQL Module Types 10-4
Creating Screen Modules with No Data Usages 10-5
Creating Menu Modules 10-7
Defining a Module Network 10-8
Menu Styles 10-11
Using Action Items to Control Navigation 10-12
Repeating Modules in the Network 10-14
Defining Links to External Web Pages 10-15
Generating the Module Network 10-17
Distributing a Web PL/SQL Application 10-18
Summary 10-20
Practice 10—1: Creating a Launch Page Module 10-21
Practice 10—2: Using Menu Modules to Create a Menu Structure 10-22
Practice 10—3: Building an Online Help System 10-24
Practice 10—4: Creating a Module Network 10-25
Practice 10—5: Linking to a URL 10-26
Hints 10-28
Instructor Notes 10-29
Instructor Post Lesson Teaching Evaluation 10-35
Suggested Graphics 10-37

Appendix A: Solutions
Practice 1—1: Solutions A-2
Practice 2—1: Solutions A-3
Practice 2—2: Solutions A-4
Practice 2—3: Solutions A-5
Practice 2—4: Solutions A-6
Practice 3—1: Solutions A-7
Practice 3—2: Solutions A-8
Practice 3—3: Solutions A-9
Practice 4—1: Solutions A-10
Practice 4—2: Solutions A-12
Practice 4—3: Solutions A-14
Practice 5—1: Solutions A-16

..........................................................................................................................................
viii Oracle Designer 6i: Web PL/SQL Design and Generation
Contents
..........................................................................................................................................

Practice 5—2: Solutions A-18


Practice 5—3: Solutions A-19
Practice 5—4: Solutions A-20
Practice 6—1: Solutions A-22
Practice 6—2: Solutions A-24
Practice 6—3: Solutions A-25
Practice 6—4: Solutions A-27
Practice 6—5: Solutions A-28
Practice 7—1: Solutions A-30
Practice 7—2: Solutions A-31
Practice 7—3: Solutions A-34
Practice 7—4: Solutions A-36
Practice 7—5: Solutions A-38
Practice 7—6: Solutions A-39
Practice 8—1: Solutions A-40
Practice 8—2: Solutions A-41
Practice 8—3: Solutions A-42
Practice 9—1: Solutions A-43
Practice 9—2: Solutions A-44
Practice 10—1: Solutions A-45
Practice 10—2: Solutions A-46
Practice 10—3: Solutions A-48
Practice 10—4: Solutions A-50
Practice 10—5: Solutions A-51

..........................................................................................................................................
®
ix
Contents
..........................................................................................................................................

..........................................................................................................................................
x Oracle Designer 6i: Web PL/SQL Design and Generation
1
.................................

Introduction
Lesson 1: Introduction
.....................................................................................................................................................

Introduction
Aim of the Course
This course focuses on the essential tasks of generating a fully functional Web-based
application.
You can run the generated applications using any Oracle Web server, however because
we have built the course using WebDB, any references to a Web server are based on
this product.

About this Slide


Course Objectives See Page 23

Use Oracle Designer to:


• Design and build a complete
Web PL/SQL application
• Implement and enforce
company standards
Browser:
• Implement security http://

1-5

You learned the basic uses of Oracle Designer in First Class. In this course you focus
on designing and generating Oracle Web PL/SQL modules.

Topic See Page


Introduction 2
How to Learn About Oracle Designer 4
The Oracle Designer Curriculum 5
System Building 7
System Development 9
What are the Components for Web PL/SQL Generation? 10
Three-Tier Architecture 11
Where Does the Web PL/SQL Generator Fit In? 12
What About Web Forms? 13
Course Agenda 15

.....................................................................................................................................................
1-2 Oracle Designer 6i: Web PL/SQL Design and Generation
Introduction
.....................................................................................................................................................

Topic See Page


Applications for the Course 17
Practice 1—1: Browsing a Generated Application 18

Objectives
At the end of this course, you should be able to do the following:
• Browse a generated Web PL/SQL application.
• Design and build a fully-functional Web PL/SQL application that satisfies a set of
specifications.
• Control the layout and behavior of generated applications by means of preferences
and templates.
• Identify the input sources for the Web PL/SQL Generator and explain the
generated output.
• Explain how generated PL/SQL creates HTML and JavaScript to implement
applications.
• Define client-side JavaScript and server-side PL/SQL against module event points
in the Repository.
• Create applications that are easy to navigate by linking screen and menu modules
in a network.
• Use the Web PL/SQL Security API to implement authorized or self service
security.

.....................................................................................................................................................
1-3
®
Lesson 1: Introduction
.....................................................................................................................................................

How to Learn About Oracle Designer


Oracle Designer is a powerful, but complex product. Learning how to use it takes time.
Completing the First Class course was the first step, which gave you a practical,
hands-on overview.

About this Slide


Learning Oracle Designer See Page 23
Experience
• Master tools,
Focus Courses technique, and
• Learn technique theory
First Class
• Understand and • Make music!
• Learn the tools
apply theory
d
• Recognizetetheory
le • Play complex
mp
• Play osimple pieces pieces
C

1-6

First Class
The goal of First Class is to teach you the basic use of the key components of the
Oracle Designer toolset. The course is broad in scope, but not deep. First Class stresses
the default behavior of the Oracle Designer toolset.
As its name suggests, First Class is the mandatory prerequisite for all the other courses
in the Oracle Designer curriculum.

Focus Courses
Each focus course teaches a particular area of Oracle Designer in detail.

Experience
The Oracle Designer curriculum introduces you to the most important features of
Oracle Designer and prepares you for using Oracle Designer in the workplace, but it
cannot substitute for experience using the tool on a real project.

.....................................................................................................................................................
1-4 Oracle Designer 6i: Web PL/SQL Design and Generation
The Oracle Designer Curriculum
.....................................................................................................................................................

The Oracle Designer Curriculum


In the focus courses you learn more about Oracle Designer.

About this Slide


Oracle Designer Curriculum See Page 23

Systems Server Design


Modeling & Generation

First
Class

Web PL/SQL Form Design


Design & & Generation
Generation

1-7

Oracle Designer 6i: Systems Modeling


This course emphasizes the need for thorough analysis and teaches you how to
maximize the Oracle Designer analysis capabilities to implement analysis techniques.

Oracle Designer 6i: Server Design and Generation


This course teaches you to use Oracle Designer to apply relational database principles
and techniques to build an OLTP server model.

Oracle Designer 6i: Forms Design and Generation


This course teaches you how to improve productivity and ease application
maintenance by using Oracle Designer to design and build forms applications.

Oracle Designer 6i: Web PL/SQL Design and Generation


This course teaches you the essential tasks of generating a fully-functional Web-based
application from start to finish.

.....................................................................................................................................................
1-5
®
Lesson 1: Introduction
.....................................................................................................................................................

The Roadmap
The curriculum path illustrates the order in which you should take the courses. The
Oracle Designer curriculum is designed to bring you up to speed quickly and to
maximize your productivity.
About this Slide
Curriculum Path See Page 23

Oracle Designer Data Modeling


Oracle Designer
First Class and
Systems Modeling
Relational Database Design

Oracle Designer
Server Design
Oracle Designer and Generation
New Features
Oracle
Oracle Designer
Designer R2:
Forms
Forms Design
Design
and
and Generation
Generation

Oracle Designer
Web PL/SQL Design and
Generation

Managing Development
Using Oracle Repository

1-9

Related Courses
Oracle Designer: Forms Design and Generation teaches topics related to the material
in this course.
For more information, see an Oracle University catalog or speak with your Oracle
University sales consultant.

.....................................................................................................................................................
1-6 Oracle Designer 6i: Web PL/SQL Design and Generation
System Building
.....................................................................................................................................................

System Building
Developing an entire system is a daunting task, even for experienced application
developers.

About this Slide


Building Systems that Work See Page 24

I need a recipe
…and a tool that
that tells me
automates the
process.

… what to do

…and how to do it

1-10

Your company may have decided to use Oracle Designer; that is why you attended
First Class and have now decided to attend this course.
You know that you need to perform an enormous set of tasks and that many of the
tasks are dependent on each other. You also know that there are many techniques and
methodologies that are available to support you in your project. But which ones do you
choose?
You also know that there are tools that can help you achieve your goal of designing
and building a system.
How do you make it all work???

.....................................................................................................................................................
1-7
®
Lesson 1: Introduction
.....................................................................................................................................................

Methods, Techniques, and CASE Tools

About this Slide


An Approach to Building Systems See Page 24

What do you do? How do you do it?


Method Techniques
• Process modeling
CDM • Table Design
• Denormalization

...
Can you automate it?
Tools

1-11

What Do You Do? The answer to this question is “follow a method.” A method
addresses the specific tasks required and specifies the order in which they follow,
much like a recipe. As you follow the method, each task is clearly outlined and you
can have confidence that, after completing all the tasks, you will achieve the desired
result.
The Custom Development Method (CDM) is Oracle’s official method.

How Do You Do It? The answer to this question is “apply techniques.” A technique
focuses on how to do each of the tasks that the method describes. Each technique
furthers the method by producing a specific deliverable, which then provides input to
the next task.

Can You Automate It? The answer to this question is “use tools.” A tool can
automate the mundane, repetitive tasks that often lead to errors when performed
manually. Do not expect a tool to provide a magic solution; tools can only facilitate the
tasks, thereby freeing up your time for more conceptual tasks.
This course focuses on the Tools component and how Oracle Designer automates the
creation of models that specify requirements. You should remember, however, that you
need more than tools to build a system successfully; you also need a method and
techniques.

.....................................................................................................................................................
1-8 Oracle Designer 6i: Web PL/SQL Design and Generation
System Development
.....................................................................................................................................................

System Development
When you develop a system, you perform three major tasks: analysis, design, and
build. Oracle Designer tools help you to take real-world system requirements and
generate a working system that satisfies those requirements.

About this Slide


System Development in Context See Page 25

Business Requirements
Process Information

Analyze

Design

Browser:
http://

Build

Application
1-12

Business requirements are the input to the development process. The output is the
application, which consists of the database and the screens, reports, and menus.
The left half of the circle relates to the processes that comprise what the company
does. The right half relates to the information that is needed to support the processes.
Dividing the circle horizontally, you can see that the upper half represents the analysis
of the business requirements, both in terms of what the company does and the
information that the business needs to hold.
The lower half of the circle represents the design and build stages of the development
life cycle. The vertical jagged arrows that point to design and build represent the
transformation of definitions from analysis to design.

.....................................................................................................................................................
1-9
®
Lesson 1: Introduction
.....................................................................................................................................................

What are the Components for Web PL/SQL Generation?


The World Wide Web
The Internet has existed for over 30 years. However, it was not easy to use until the
advent of the World Wide Web. The Web sits on top of the Internet, and allows the
distribution and retrieval of information over the Internet in a manner that makes the
mechanisms completely invisible to the end user. End users, or Web clients, use Web
browsers to request information from Web servers.

About this Slide


The Technology We Use See Page 25

Oracle Designer Web PL/SQL Generator

WebDB

1-13

Web Servers
There are many Web servers on the market today. Some of the common ones are
developed by Oracle, NCSA, Netscape, and Microsoft. Web servers serve requested
files to Web clients.

WebDB
Oracle Web servers differ from other Web servers in that they can retrieve information
dynamically from an Oracle database to send to a Web client, as well as serving
traditional static files.
WebDB retrieves the data from an Oracle database by executing PL/SQL procedures
in the database.

.....................................................................................................................................................
1-10 Oracle Designer 6i: Web PL/SQL Design and Generation
Three-Tier Architecture
.....................................................................................................................................................

Three-Tier Architecture
Client–Server
Oracle applications traditionally run in a client–server environment. The database
resides on one machine, the Server, and the application code resides on separate
machines, the Clients. Since the application code resides on the clients, it does not
place a load on the server.

Three-Tier Architecture

First tier Second tier Third tier

2
a 11..11..2
JJaavva

Browser Web server Database

1-14

Extending Client–Server with the WebDB


The introduction of the Web and the WebDB server introduces a new structure:
• Web client (Web browser)
• Web server and database client (WebDB)
• Database server (Oracle8i)
Note: The Web client communicates with WebDB using HTTP. WebDB
communicates with the database server using SQL*Net.
Client code created by the Web PL/SQL Generator resides as PL/SQL in the database
server. The PL/SQL creates HTML and JavaScript that is interpreted by the Web
browser.

Advantages of Three-Tier Architecture


• It is cheaper and easier to deploy and maintain applications.
• It provides centralized control over deployment and maintenance.

.....................................................................................................................................................
1-11
®
Lesson 1: Introduction
.....................................................................................................................................................

Where Does the Web PL/SQL Generator Fit In?


Oracle Designer
Oracle Designer is a true and tried technology that enables analysts and designers to
design and implement applications rapidly. Its structured methodologies give access to
the easy generation of application code (PL/SQL) that is basically algorithmic.
About this Slide
The Oracle Web PL/SQL Generator See Page 26

8
Module design
specification Web server

Requests

Dynamic HTML
pages
Web PL/SQL
Generator

Web client

1-15

The Web PL/SQL Generator


The Oracle Designer Web PL/SQL Generator successfully draws upon the analysis
and design work that you enter into the Oracle Designer Repository to automatically
and quickly generate the PL/SQL that the Web server executes.
The main input to the generation process is a module design specification, which you
record in the Design Editor. Other inputs to the generation process include module
links and preferences that determine the general look and feel of the generated
application. You can customize them to suit your particular requirements.
The Web PL/SQL Generator creates a set of PL/SQL packages that you can install into
an Oracle database account. The generated PL/SQL packages make use of the Oracle
Web PL/SQL Developer’s Toolkit and the Web PL/SQL Generator Library Package
(WSGL).

The Web Server


The Oracle Web server solution serves real-time, dynamic documents by executing
PL/SQL packages stored in an Oracle database. These are the PL/SQL packages that
the Web PL/SQL Generator creates.

.....................................................................................................................................................
1-12 Oracle Designer 6i: Web PL/SQL Design and Generation
What About Web Forms?
.....................................................................................................................................................

What About Web Forms?


Not all modules are suitable for deployment on the Web. Ask yourself this question:
Why do I want to develop modules for the Web?
When developing an application system, one of the first things you need to decide
when leaving the analysis stage of development, is what development environment
you are going to use to implement your modules, for example, Oracle Forms or
Microsoft Visual Basic. You may want to develop Web modules that support your
primary application.
About this Slide
Choosing a Web Implementation See Page 26

Web Pages Developer

Oracle Web PL/SQL Oracle Forms


Generator Generator

Oracle Developer
Application
Web Pages
with HTML Web Browser Workstation

Developer on the Web Runform


Java applet
1-16

Transaction-Based Applications
If you require a heavy throughput, transaction-based application, perhaps
Oracle Forms is a more suitable choice. For example, data capture clerks entering
large amounts of data are unlikely to use Web modules to record the details.
However, you may develop Web modules that allow users to view data that has been
entered through the primary application. Perhaps they may even want to make simple
updates to the data. For example, managers based at head office may want to view data
in a local store’s database.

Web Forms
You can deploy Oracle Forms over the Web without modifying them.
1 The Web browser downloads a Java applet from a Web server. It then disconnects
from the Web server.
2 The applet connects to a separate application server. This listener spawns a process
on the server that connects to the database and runs the forms module.

.....................................................................................................................................................
1-13
®
Lesson 1: Introduction
.....................................................................................................................................................

3 The form runs on the application server. The Java applet in the browser
communicates with the runform process on the server. The Web server is out of the
picture.
The runform process on the application server maintains a database session on the
database server. The application server connects to the database with SQL*NET.
The Forms Generator of Oracle Designer can help to develop the application.

Do You Need Web Pages?


Web Forms is an Oracle Forms application that uses a Web browser to paint the screen.
However, you may not want to deploy a full Forms application on the Web, simply to
enable customers to access some data. A Web PL/SQL module that uses PL/SQL to
create HTML pages is much more suitable. So, if you need Web pages, use the Web
PL/SQL Generator.

.....................................................................................................................................................
1-14 Oracle Designer 6i: Web PL/SQL Design and Generation
Course Agenda
.....................................................................................................................................................

Course Agenda

Course Agenda
Day 1

• Introduction
• Generating Web PL/SQL Modules
• Setting up the Generation Environment
• Designing Web PL/SQL Modules

1-17

Course Agenda
Day 2

• Changing the User Interface


• Implementing User Interface Standards
• Building More Complex Modules

1-18

.....................................................................................................................................................
1-15
®
Lesson 1: Introduction
.....................................................................................................................................................

Course Agenda
Day 3

• Defining Application Logic


• Using the Web PL/SQL Security API
• Completing Your Application

1-19

.....................................................................................................................................................
1-16 Oracle Designer 6i: Web PL/SQL Design and Generation
Applications for the Course
.....................................................................................................................................................

Applications for the Course


The guided practices are based on a fictional video rental company named Hollywood.

About this Slide


The Practice Application See Page 27

• A fictional e-commerce site


• Customers can:
– Change membership information
– Browse through available titles
– Rent titles

1-20

When you attended First Class, you used an abbreviated version of Hollywood that
contained three entities: Title, Supplier, and Copy. In this course you use an extended
version of Hollywood that represents a complete business model.
In this course, you build an e-commerce site for Hollywood. This site enables
Hollywood customers to:
• Change their personal and membership details.
• Browse through information about the latest titles available.
• Reserve and rent titles.
Of course, an enterprise like Hollywood has a number of other areas of activity, such
as accounting and marketing. The Head Office deals with these areas, so they are not
part of the daily operation of the e-commerce site.

.....................................................................................................................................................
1-17
®
Lesson 1: Introduction
.....................................................................................................................................................

Practice 1—1: Browsing a Generated Application


Goal
The purpose of this practice is for you to browse the completed Hollywood
e-commerce site.

Scenario
In this course you build an e-commerce site for Hollywood. This site enables
customers to change their personal and membership details, browse through
information about available titles and rent titles. You browse the completed application
to identify topics that you learn about in the course.

Your Assignment
You need the following information, which your instructor has assigned to you,
throughout the course:

Web server
Port <default>
Agent wg_dad
User ORA<nn>/oracle
Working Directory

where <nn> is the group number that your instructor has assigned to you.
1 Invoke the browser and enter the URL
http://<webserver>:<port>/<agent>/rental_menu$.startup
2 When prompted, enter demo/oracle for username/password.
3 Select Coming Soon!.
4 How many titles are displayed?
5 Return to the main menu.
6 Select Browse through Movie Titles.
7 Find all movies. How many times does MOVIE appear in the list of returned titles?
8 Return to the main menu.
9 Select Maintain Personal Details.
10 Log on as customer BART whose password is also BART.
Note: You may need to supply the demo/oracle Web Server username/password
again.
11 Can you see details for all customers?
12 Exit Hollywood.

.....................................................................................................................................................
1-18 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 1—1: Browsing a Generated Application
.....................................................................................................................................................

13 Enter the URL again and select Rent a title. What happens?
14 Log on using your own ORA<nn> username and password. What happens?
15 Fill in all details and log on again
16 Add a new rental. Which customer name appears for the rental?
17 Add two rental items of your choice to the new rental.
18 Return to the main menu
19 Exit Hollywood.

.....................................................................................................................................................
1-19
®
Lesson 1: Introduction
.....................................................................................................................................................

Hints
Practice 1—1

To perform this task Follow these steps


To find all movies 1 Click Find.
from the Browse
through Movie
Titles application
To log on to the 1 Enter Username.
Maintain Personal 2 Enter Password.
Details application
3 Click Log on.
To add a new rental 1 Click New
using the Rent a 2 Accept the default Transaction Date.
title application
3 Click Insert.
To add a new rental 1 Click the Rental Items link for the required rental.
item using the Rent 2 Click New.
a title application
3 Click List of Values image to select a title from the list
(repeat this for each item required).
4 Click Insert.

.....................................................................................................................................................
1-20 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Instructor Notes
Applications
The following workareas exist in the TEACH account:
• HOLLYWOOD_MAIN
• WG_DEMO
• WG_FILES
• WG_OWNER_LES02_STP
• WG_OWNER_LES04_SOL
• WG_OWNER_LES05_SOL
• WG_OWNER_LES06_SOL
• WG_OWNER_LES07_SOL
• WG_OWNER_LES08_SOL
• WG_OWNER_LES09_SOL
The following workareas should be in each student account:
• ORA<nn>_stp
• ORA<nn>_LES05_STP
• ORA<nn>_LES06_STP
• ORA<nn>_LES07_STP
• ORA<nn>_LES08_STP
• ORA<nn>_LES09_STP
• ORA<nn>_LES10_STP
The following shared applications should be available to the TEACH account and
each student account:
• GLOBAL_SHARED_WORKAREA
• WG_OWNER_LES02_SOL
• WG_OWNER_LES10_SOL

Client Side Files


You should also find a set of client files. By default, these will be placed in your
working directory. The working directory should be set up using the course code, so
you would have something like c:\20007. If you do not know which is your working
directory, check with your Education Setup Support team.

.....................................................................................................................................................
1-21
®
Lesson 1: Introduction
.....................................................................................................................................................

Practices
The practices follow the Goal/Scenario/Your Assignment pattern set by First
Class. Please emphasize to students that they need to read the goal and scenario if
they are to understand what is required of them in the practice. At the end of each set
of practices for a lesson there is a single Hints section. As in First Class, the hints are
generic, that is, they describe how to carry out a particular task generically, not
specifically in this situation. There are solutions for each practice in Appendix A.
Some lessons have many practices. Some delegates will not complete every practice
for every lesson. However you may find having a large number of practices useful
for those delegates who race through the material. Where a set of practices is
dependent on the previous set, we have created a configuration and a workarea based
on the position at the end of the lesson. If students need to continue with a correct set
of data, they should use the appropriate work area. For example, if they need to start
afresh in Lesson 5, tell them to use the workarea named ORA<nn>_Les05_stp.
Try to recap after each practice: there is great value in going over the main learning-
points of a practice after a class has completed it.
Some lessons are quite long with distinct learning points in them. For this reason we
recommend that you break up the lesson with practices. We have put a practice
introduction slide at those points in the lesson where we think that practices would
usefully break up the lesson. The idea is that you then break at that point in the lesson
and let the students perform the practice. You can, of course, place practices
wherever is most suitable for your learning environment.
Pace of the Course
There should be a relatively comfortable pace for the duration of the course. You
should aim to start Lesson 4 by the end of day 1 and get through at least some of the
practices. You should finish lesson 7 by the end of day 2 leaving just three lessons to
cover on day 3. Some students will be keen to know more about Web server
configuration and terminology. Explain to these students that Oracle offer Web
Server Administration courses where they can learn more about the subject.

Schedule
Timings Topic
45 minutes Lecture
O racle D esig ner 6i:
W eb PL /S Q L D esig n an d G eneration
15 minutes Practice
60 minutes Total

1-1

.....................................................................................................................................................
1-22 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

About this Slide


C o urse O b jectives
These are very high-level objectives.
U se O racle D esig n er to :
• D esign an d b u ild a co m p lete
W eb P L /S Q L ap p lication
• Im p lem en t an d en force
c om pan y sta nd ard s
B row se r:
• Im p lem en t secu rity http://

1-5

About this Slide


L earn ing O racle D esig ner
E x p erie nce
This is a reminder to participants of the
F o cus C o urses
• M aster to o ls,
tech n iq u e, an d
relationship between First Class and the focus
F irst C lass • L earn tech n iq u e th eo ry
• U n derstan d and • M ake m u sic!
courses, and the objectives and scope of each.
• L earn th e to o ls
ap p ly th eo ry

p le
d eo ry
• R eco g nizet eth
• P lay co m p le x All the students in your class should have
• P lay osim
m p le p ie ces p iece s
C
attended First Class. You may sometimes have
students who have not attended it. Ignore the
1-6
temptation to fill in gaps for them. It is their
problem if they did not meet the prerequisites.
About this Slide
O racle D esig ner C u rricu lum
First Class is the central and prerequisite
S ystem s
M odeling
S erver D e sign
& G enera tion
course in the Designer curriculum; focus
courses can be taken separately according to
First
C lass the needs, the skills and the task they need to
W eb P L/S Q L Form D esign
perform.
D esign & & G eneratio n
G eneration
This slide specifies the focus courses that are
1-7 available. Try not to slip into sales mode when
describing the other courses: your students
may feel irritated if they feel they are the
object of a sales pitch.
About this Slide
C urricu lu m P ath
D ata M od eling
odelin g
This slide shows the recommended path
O racle D esig ner
esigner O racle
ra cle D esig ner
esigner
First C lass
R elation
and
al D atabase D esign
elatio nal
System
S ystem s M odelin
od elingg
participants should follow in the Oracle
O racle
ra cle D esig ner

O racle D esig ner


esigner
S
Seerver
esigner
rver D esign
and G eneration
eneratio n
Designer curriculum.
N ew Features
F eatures
O racle
O racle
ra cle D esig
D esig nerner
esigner
esign er R 2:
Fo
Form
and
and G
rm ss D
Design
es ign
Generation
eneratio n There is a separate course for students who
O racle
W eb P
ra cle D esig ner
esigner
L/S Q L D esign and
PL/S
G eneratio n
wish to learn more about WebDB installation
M anaging
anagin g D evelo pm ent
evelopm
U sing O racle R epository
and administration.
1-9

.....................................................................................................................................................
1-23
®
Lesson 1: Introduction
.....................................................................................................................................................

About this Slide


B u ild ing S ystem s th at W ork
This slide is repeated from First Class and is a
I need a re cipe
that tells m e
… and a tool that
reminder of the context and role of Oracle
auto m ates the
process.
Designer.
… w hat to do
It leads into the discussion of method,
… a nd how to do it technique and tool which is coming on the next
slide.
1-10

About this Slide


A n A ppro ach to B uild in g S ystem s
This slide is also repeated from First Class and
W hat do you do?
M ethod
H ow do yo u do it?
Techniques
sets the context. It illustrates the three major
CDM
• P rocess m o deling
• Table D esign
components needed to construct an application
• D enorm aliza tion

...
system. Each part of the pie answers a major
C an you autom ate it?
Too ls
question in the development.
Mention CDM and Oracle Designer but keep
1-11 the discussion general.
A method is like a recipe.
Techniques show you how to perform part of
the recipe (like whipping cream, if you want to
continue the recipe analogy).
A tool automates the process (like an electric
mixer—you could whip cream without it, but it
makes the job easier).
After the recipe has been successfully
followed, you may decide to make changes to
suit the taste of the cook. As good application
analysts and developers, you should make the
method fit your organization’s tastes.

.....................................................................................................................................................
1-24 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

About this Slide


S ystem D evelo p m en t in C on text
B usin ess R eq u irem en ts
This context diagram is used throughout the
P rocess In fo rm atio n curriculum in various forms. Here, it serves to
A nalyze show the whole of the systems development
D esign
process and the place of development in that
B ro w s er:
http ://
process. The slide zooms in to the lower left
B uild
section of the circle as this is the scope for this
A pp licatio n
1-12
course. You should discuss the models on each
side of the lower half of the circle, but avoid
discussing the upper half of the circle except at
a very high level (many participants will not be
interested and you do not want to ‘lose’ them
at such an early stage, also you could waste a
lot of time on it).
Use the term “development life cycle” here.
The idea is that business requirements are fed
in at the top and ultimately you produce a
working system (both database and
applications). Oracle Designer encompasses
the whole development life cycle.
Stress that this course focuses on the area of
designing and generating Web PL/SQL
modules. Recap the tools that they were
introduced to in First Class. Tell them that this
course uses the Design Editor.
About this Slide
T he Tech no lo gy W e U se
Introduce the tools that they will use in the
course: do not start explaining them at this
point. Lessons 2 and 3 cover Web server
O racle D esigne r W eb P L/S Q L G ene rator
technology and the rest of the course goes into
Design Editor details.
W ebD B

1-13

.....................................................................................................................................................
1-25
®
Lesson 1: Introduction
.....................................................................................................................................................

About this Slide


T h ree-T ier A rch itecture

First tier S eco nd tier Th ird tier

2
.1 ..2
a 11 . 1
JJaavv a

B row ser W eb server D a tabase

1-14

About this Slide


Th e O racle W eb P L/SQ L G en erator
This is to remind the group about the Web PL/
SQL Generator and where it fits in.
8
M odule design
specification W eb s erver You can introduce the idea that the generator
R eque sts
produces PL/SQL from the module definition
W eb P L/S Q L
D yn am ic H TM L
pag es and it is this PL/SQL that is interpreted by the
G enerator

W eb client
Web server to produce web pages.
1-15

About this Slide


C h oo sing a W eb Im p lem entation
Introduce the idea of Web Forms versus Web
pages. It is important to emphasize that this
W eb Pages D eveloper
course does not cover Web Forms. There are
O racle W eb P L/S Q L O rac le Form s
G enerator G e nerator

O racle D eve loper


Forms Builder courses and a seminar that
W eb P ages
A pplicatio n
cover setting up and using Web Forms.
w ith H TM L W eb B row ser W orkstation

D evelo per on the W e b R un form


Ja va applet
1-16

Class Management

Can you generate Web Forms directly from Oracle Designer? Yes! You
merely create a .fmb file using the Forms Generator. You need to recompile the .fmb
file to create the .fmx file for the required platform.

Which approach should I use? If you have an existing application that you want
to deploy on the Web, it is advantageous to use Web Forms because you just need to
recompile and deploy the forms. However, if you are starting a new application it is
worth considering using the Web PL/SQL Generator.
Another consideration when making these choices is that when you use Web
PL/SQL generated pages, the connection is released after each call. With Web
Forms, the application server has dedicated processes for each form instance. This
can be a scalability problem, since multiple users create more network traffic. It
should be confirmed whether Web Forms work through a firewall: previously they
did not.

.....................................................................................................................................................
1-26 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

About this Slide


C o urse A g en da
D ay 1

• In trod u ctio n
• G en era tin g W eb P L /S Q L M o d u les
• S ettin g u p th e G en eratio n E n v iro n m ent
• D esign in g W eb P L /S Q L M o d u les

1-17

About this Slide


C o urse A g en da
D ay 2

• C h an g in g the U ser In terface


• Im p lem en tin g U ser In terface S tan d ard s
• B u ild in g M o re C o m p lex M o d ules

1-18

About this Slide


C o urse A g en da
D ay 3

• D efin in g A p p licatio n L o g ic
• U sing th e W eb P L /S Q L S ecu rity A P I
• C o m p leting Y o ur A p p lica tion

1-19

About this Slide


T he P ractice A p plication
The students were introduced to Hollywood in
• A fiction al e-com m erce site First Class. The version of Hollywood used in
• C u sto m ers c an :
– C h an g e m em b ersh ip inform atio n First Class is only a small part of a larger one
– B ro w se th ro u g h availab le titles
– R ent titles that is used in each focus course. Some
students may already be familiar with it if they
have taken other focus courses.
1-20 Hollywood is CDM-compliant in most cases.
There are some areas of the model that were
carried over from earlier versions due to time
constraints.
Note: There is a real Hollywood chain of video
rental stores in the United States, but we
named our application system before we knew
this.

.....................................................................................................................................................
1-27
®
Lesson 1: Introduction
.....................................................................................................................................................

Practice 1—1
P ractice
It is the responsibility of the instructor to tell
• V iew the com p leted e-co m m erce site fo r the students the value for Web server and
H o llyw o od
Working Directory to add to their table of
information required for the duration of the
course.

1-21

Create Recovery Workareas:


The setup is shipped with solution workarea specifications. A student may need a
workarea to recover from a practice they were unable to successfully complete. To
create a recovery workarea, follow the steps below.
1 Log in on the student’s machine.
2 Create a branch named ORA<nn>_LES<nn>. Where <nn> is first the student
number and second the lesson your recovering from.
3 Create a Private Workarea as follows:
a Name it ORA<nn>_LES<nn>_REC. Where <nn> is first the student number
and second the lesson your recovering from.
b Set the Checkin Branch to the one you created in step 1.
c Load the Specification from a file found in the \recovery\directory on the
students machine. The file is named using the lesson number, and represents
the solution of the prior lesson. Select the correct file and Finish.

.....................................................................................................................................................
1-28 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Post Lesson Teaching Evaluation
.....................................................................................................................................................

Instructor Post Lesson Teaching Evaluation


Name: Full Email:

Course Name: Oracle Designer 6i: Web PL/SQL Design and Generation
Lesson number: 1
Number of teaches before filling this form: 1 - 2 - 3 to 5 - >5

Global comments: (circle all that apply)


• Lesson content: Trivial - Too easy - OK - Difficult - Too difficult
• Slide content: Too many slides - Too few slides - O.K
• Text content.Too much text - Not enough text - Unclear - O.K.
• Practice content: Too difficult - Too easy - Problems - O.K.

Detail comments
Content type: Slide - Text - Practice - Instructor notes
Note: 1:needs animation - 2:too much animation - 3:needs more text - 4:too much text
- 5:Unclear - 6:not necessary - 7:Other

Content Page
Note Comments/Suggestions
Type Number

Photocopy this page and fax to: Oracle Designer Curriculum Development @ +(44) 118.924.5181
Additional sheets are available at the end of the instructor’s guide.
If you draw additional diagrams on the white board use the Graphic sheet in the Instructor Evaluation
section at the end of this book.

.....................................................................................................................................................
1-29
®
Lesson 1: Introduction
.....................................................................................................................................................

.....................................................................................................................................................
1-30 Oracle Designer 6i: Web PL/SQL Design and Generation
Suggested Graphics
.....................................................................................................................................................

Suggested Graphics
Instructor name: Full email:

Course Name:Oracle Designer 6i: Web PL/SQL Design and Generation


Lesson No: 1 Page No:
Please sketch your additional diagram below.

.....................................................................................................................................................
1-31
®
Lesson 1: Introduction
.....................................................................................................................................................

Oracle Designer Education Products


Curriculum Development
520 Oracle Parkway
Thames Valley Park
Reading - Berkshire
England

fold here

.....................................................................................................................................................
1-32 Oracle Designer 6i: Web PL/SQL Design and Generation
2
.................................

Generating Web PL/SQL


Modules
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

Introduction
In this lesson you learn how to generate, install, and run Web PL/SQL modules.
Schedule
Overview See Page 23

Class
Management
• How do I generate and install a module?
• How do I run a module?
See Page 23
• What is generated?

2-2

Topic See Page


Introduction 2
Setting Web PL/SQL Generator Options 4
Generating a Module 6
The Generate Web PL/SQL Dialog 7
Inputs to the Generator 8
Outputs from the Generator 9
Installing the Generated PL/SQL 10
Running a Module 11
Understanding the Module Structure 13
Making Module Components Reusable 15
Summary 16
Practice 2—1: Generating a Simple Module 17
Practice 2—2: Installing and Running a Simple Module 18
Practice 2—3: Exploring the Module Structure 19
Practice 2—4: Making a Module Component Reusable 20

.....................................................................................................................................................
2-2 Oracle Designer 6i: Web PL/SQL Design and Generation
Introduction
.....................................................................................................................................................

Objectives
At the end of this lesson you should be able to do the following:
• Generate a Web PL/SQL module
• Install and run a Web PL/SQL module
• Explain the items that are generated by the Web PL/SQL Generator

.....................................................................................................................................................
2-3
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

Setting Web PL/SQL Generator Options


Before you begin to generate your Web PL/SQL modules, you can set the generation
options. Select Options—>Generator Options—>Web PL/SQL.

About the slide


Generator Options See Page 23

Demo
Location of
source files
See Page 23

Location of
target files

User account
Auto-install
option

Browser
URL

2-4

Source Files
You may choose to use template files in your Web PL/SQL modules. You can store
these templates in the file system or the repository. In this area of the dialog box, you
instruct the generator to read these files from the file system or a repository folder
during the generation process.

Target Files
The generator saves the generated packages in the directory named in the Destination
of Generated Files field. If you select the check box, the generator also uploads the
generated files into the repository.

Installing Generated PL/SQL Automatically


To install the generated packages automatically, select the Auto-install after
Generation check box and enter the following details:
• Application user account (and password, to save typing it for subsequent
generations)
• SQL*NET database alias or connect string
The generator automatically installs the generated package if the generation phase
completes without error.

.....................................................................................................................................................
2-4 Oracle Designer 6i: Web PL/SQL Design and Generation
Setting Web PL/SQL Generator Options
.....................................................................................................................................................

Running Generated Applications Automatically


You can instruct the generator to run the generated application in a Web browser by
specifying the following information:
• The directory path of your preferred browser
• The URL that identifies your Web application server and PL/SQL access
mechanism. You do not have to add the package and startup procedure names.
If the generation and installation of the module completes successfully, you can run it
from the Build Actions window.

.....................................................................................................................................................
2-5
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

Generating a Module
You can invoke the Web PL/SQL Generator from the module diagram or the Design
Navigator.

About the slide


Generating Modules See Page 23

Generate Tools Options


Generate Module...
Generate Module As...

Generate Database from Server Model...


Generate Database Administration Objects...

Generate Table API...

Generate Web PL/SQL

Module MEM0010
Include Module Network?

Post Generation
Commit Revert Browse/Edit mode

Start Options Cancel Help

2-5

Selecting a Module to Generate


1 Select the module in the Modules Tab panel of the Design Navigator.
2 Open the module diagram in one of the following ways:
– Drag the diagram icon from the Modules Tab panel of the Design Navigator
onto the Design Editor window
– Highlight the diagram name in the Design Navigator and use File—>Open—>
Module Diagram)

Invoking the Web PL/SQL Generator


Once you have selected the module that you want to generate, you invoke the
generator in one of the following ways:
• Right-click on the module name and select Generate... from the menu
• Click on the generator icon on the toolbar.
• Select Generate—>Generate Module from the menu.

.....................................................................................................................................................
2-6 Oracle Designer 6i: Web PL/SQL Design and Generation
The Generate Web PL/SQL Dialog
.....................................................................................................................................................

The Generate Web PL/SQL Dialog


The Generate Web PL/SQL dialog box displays the name of the module that you chose
for generation.

About the slide


Generator Dialog Box See Page 24

Generate Web PL/SQL

Module name Module MEM0010

Include Module Network?


Select to generate
entire module
network Post Generation
Commit Revert Browse/Edit mode

Start Options Cancel Help

2-6

• Select the check box to generate the chosen module and all its child modules in the
same run. You can generate all the modules in your application by generating the
root or Launchpad module and selecting the Include Module Network? check
box.
• Enter the password of the application user account into the Installation user
password field, if you chose to auto-install your generated Web PL/SQL module
and you did not enter the password into the Options dialog.
• Select the appropriate postgeneration option:
– Commit updates repository objects when generation is complete.
– Revert does not update repository objects with the property settings used
during generation.
– Browse/Edit mode activates postprocessing mode, in which you can choose
how to process proposed repository changes.
• Click the Start button to start the generation.
You can follow the progress of the module generation process in the Message
Window. It displays warnings and errors from the Web PL/SQL Generator.

.....................................................................................................................................................
2-7
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

Inputs to the Generator


During generation, the Web PL/SQL Generator reads information from the repository.

Class
Generator Inputs Management
See Page 24

Generator
preferences

Module
definition

Module
network

2-7

Module Definition
The module design created in the Design Editor is the chief input to the Web PL/SQL
Generator. The operations on the table usages and the detailed column usages
constrain the code that the generator creates in PL/SQL. For example, the module
component table usages define the pages generated for the module.

Module Network
If your application consists of more than one module, your description of the module
network instructs the generator how to build hypertext navigation links between the
modules.

Generator Preferences
The Web PL/SQL Generator Preferences Navigator in the Design Editor gives you
access to preferences that govern the look and feel of the generated application.

.....................................................................................................................................................
2-8 Oracle Designer 6i: Web PL/SQL Design and Generation
Outputs from the Generator
.....................................................................................................................................................

Outputs from the Generator


The generator creates several packages. They are written to files and you can also
choose to install them automatically into the database.
Class
Generator Output Files Management
See Page 24
.PKS and .PKB files

• Module startup
package
• Module component
packages

.SQL file
Browser:

http://

2-8

Module Package
The generator creates a package for the module. The name of this package is the
module implementation name with a dollar sign ($) suffix, for example, PERSONAL$.

Module Component Packages


The generator creates two packages for each module component. The names of the
packages are formed by concatenating the name of the module package with the
implementation name of the module component, for example, PERSONAL$CUS_MC
and PERSONAL$JS$CUS_MC. The procedures within these packages provide the
functionality for the pages required.

Files
The generator creates the following files:
• A .pks file containing the package specifications
• A .pkb file containing the package bodies
• A .sql file that runs the .pks and .pkb files during automatic installation
The filenames are of the form CVW<Module_Implementation_Name>.XXX. If
you generate more than one module, the filename prefix uses the implementation
name of the root module on that run.

.....................................................................................................................................................
2-9
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

Installing the Generated PL/SQL


If you have selected the Auto-install after Generation check box, the PL/SQL is
installed automatically after a successful generation.
Class
Installing the Application Management
See Page 24
• Select auto-install after generation
or
• Double-click to install
Build Action
Description Run
Install Generated packages in user
Cancel
Run generated application
View package specification
View package body
Help

or
• Install manually from .SQL file

2-9

Installing a Module Immediately After Generation


1 Click on the List Actions icon in the Message Window toolbar.
2 Select Install Generated packages in user.
3 Click Run.
The packages are installed into the application user account and the database connect
string that you entered in the Generator Options dialog box.

Installing a Module Manually


1 Invoke SQL*Plus.
2 Connect to the user account.
3 Execute the module installation script CVW<implementation_name>.SQL to
install the .pks and .pkb files. (Alternatively, you can choose to install the .pks and
.pkb files separately.)

Checking the Installation


The installation process creates a log file (cvwsgin.log) in <ORACLE_HOME>\bin.
You can examine it to find out if the installation process encountered any errors.

.....................................................................................................................................................
2-10 Oracle Designer 6i: Web PL/SQL Design and Generation
Running a Module
.....................................................................................................................................................

Running a Module
If the Web PL/SQL module is successfully installed, you can run it in a Web browser.

Running the Application After Generation

Running the Application

• Double-click to run
Build Action
Description Run
Install Generated packages in user
Cancel
Run generated application
View package specification
View package body
Help

– Invokes the browser


– Navigates to the module URL
2-10

1 Click on the List Actions icon in the Message Window.


2 When the Build Action dialog box opens, select Run generated application.
3 Click the Run button to invoke the Startup procedure in the module package:
<implementation_name>$.startup

.....................................................................................................................................................
2-11
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

Running the Application Manually

About the slide


Running a Module Manually See Page 25

Demo
See Page 25
PL/SQL entry
agent name procedure
Practice
myServer myAgent customers$ startup
http://myServer/myAgent/customers$.startup See Page 25

Web server module


implementation
name

2-11

Invoke your browser and enter the full URL:


http://<webserver>:<port>/<agent>/<implementation_name>$.startup

.....................................................................................................................................................
2-12 Oracle Designer 6i: Web PL/SQL Design and Generation
Understanding the Module Structure
.....................................................................................................................................................

Understanding the Module Structure


When you generate a module, the Web PL/SQL Generator creates various Web pages
depending on the module component table usages. When you alter the module
structure in the Design Editor, you also affect the generated pages.

Class
Modules and Web Pages Management
See Page 25

Module Design

About Page Query Generated


Form Record Web pages
Startup Page List View
Form Insert
Form

2-13

Module Pages
The Web PL/SQL Generator creates the following pages for each module:
• Startup (or first) page
• About page

Module Component Pages


The Web PL/SQL Generator can create the following pages for each module
component:
• Query form
• Insert form
• Record list
• View form
You can control the exact number and type of the pages that the Web PL/SQL
Generator produces by altering the module information in the Design Editor.

.....................................................................................................................................................
2-13
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

Viewing the Module Structure

Class
Module Diagram Views Management
See Page 25
Data View Display View
About the slide
See Page 25

2-14

Data View You can use the data view mode of the Module Diagrammer to build
your Web PL/SQL modules. It displays the base table of each module component and
any associated lookup usages. You can do the following:
• Create module components
• Add one base table usage per module component and define Column usages
• Add multiple lookup table usages, and define their lookup column usages
• Add key-based links
• Add lists of values
Use the data view to set the query, insert, update, and delete operations for the module
component.

Display View The display view mode of the Module Diagrammer shows the
columns that the module displays and their associated GUI display types. You can use
display view to do the following:
• Define the order in which columns are displayed.
• Define the GUI display type for a column.

.....................................................................................................................................................
2-14 Oracle Designer 6i: Web PL/SQL Design and Generation
Making Module Components Reusable
.....................................................................................................................................................

Making Module Components Reusable


You can make any module component reusable by changing the module component
type property from specific to reusable.

Class
Module Component Types Management
See Page 26
Module Diagram - CUSTOMERS

MEM0010 Specific
CUS_MC Module Component

Reusable Module Component - CUS_MCR


WG_CUSTOMERS
Cus_Id CUS_MCR Reusable
Last_Name Module Component
... WG_CUSTOMERS
Cus_Id
Last_Name
....

2-15

If a module component is reusable, you can use it in several modules. You can use a
specific module component only in the module in which you created it.
To make a module component reusable, right-click it and select Make Reusable.
You can include or copy a reusable module component into a module using the
Module Diagrammer.

Modifying Reusable Module Components


You can only change the operations of a reusable module component with the Design
Navigator or in the Reusable Module Component Graphical Editor. You cannot alter
them in the Module Diagrammer. If you change the operations for a reusable module
component, they change in all modules that include the component.

Copying Reusable Module Components


If you copy a reusable module component into a module, you can change the
operations of the module component for that module alone.
1 Open a module diagram.
2 Drag the reusable module component onto the graphical work area.
3 Select the reusable module component.
4 Click the right mouse button.
5 Select Make Private Copy... from the menu.

.....................................................................................................................................................
2-15
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

Summary
Summary
Summary See Page 26

• Web PL/SQL Generator options


• Design Editor:
– Create a module
– Generate a module
– Install a module automatically
• Manual installation of a module
• Module structure and generated pages
• Reusable module components

2-16

• You can set Web PL/SQL Generator options to control the generation process.
• You can use the Design Editor to create, generate, and install Web PL/SQL
modules.
• You can also install Web PL/SQL modules manually.
• You run Web PL/SQL modules in a Web browser.
• The generator creates several pages for each module, depending on the way that
the module uses tables and columns.
• You can use a module component in several modules by making it reusable.

.....................................................................................................................................................
2-16 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 2—1: Generating a Simple Module
.....................................................................................................................................................

Practice 2—1: Generating a Simple Module


Goal
The purpose of this practice is for you to generate a Web PL/SQL module.

Scenario
The analysts have developed module MEM0010 — Maintain Personal
Details, which allows customers to view and update their personal details. You are
to generate this module.

Your Assignment
Unless otherwise indicated, all practices for the course will be completed in the Design
Editor for the WG_HOLLYWOOD application system.

Use the information below as your starting point:

Workarea ORA<nn>_stp
Application System WG_HOLLYWOOD
Tool Design Editor
Module MEM0010 – Maintain Personal Details

where <nn> is the group number that your instructor has assigned to you.
1 In the Web PL/SQL Generator options dialog
a Ensure that you do not install the module directly after generation.
b Set the Browser generator option to use Netscape.
c Set the Web Agent URL to http://<webserver>:<port>/<agent>.
2 In the Design Editor, generate the module MEM0010 — Maintain Personal
Details.
3 When the generation process finishes, investigate the generated files:
a How many files are generated?
b What are the names of the files?
c What does each file contain?
4 Find out the names of the generated PL/SQL packages.
a What is the name of the module package?
b What are the names of the module component packages?

.....................................................................................................................................................
2-17
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

Practice 2—2: Installing and Running a Simple Module


Goal
The purpose of this practice is for you to install and run a Web PL/SQL module.

Scenario
You have generated module MEM0010 — Maintain Personal Details.
You must now install it manually and run it.

Your Assignment
Use the information below as your starting point:

Module MEM0010 – Maintain Personal Details

1 .From the Build Actions window, install the generated packages.


2 From the Build Actions window, run the module. When prompted, enter your
username and password.
3 Look at the titles on the first page. The second line in a large font (Personal
Details) is the title for the module component. What is its subtitle?
4 Press Find to execute a query and see the Record List.
5 Select a record to see the View Form.
6 Which field is displayed in red?
7 List the distinct pages that you can see.

.....................................................................................................................................................
2-18 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 2—3: Exploring the Module Structure
.....................................................................................................................................................

Practice 2—3: Exploring the Module Structure


Goal
This purpose of this practice is for you to examine the basic structure of a generated
module.

Scenario
Find out more information about the structure of the module MEM0010 —
Maintain Personal Details.

Your Assignment
Use the information below as your starting point:

Module MEM0010 – Maintain Personal Details

1 In the Design Editor, create a diagram of the module.


2 Examine the diagram and answer the following questions:
a What are the names of the module components?
b There is no insert form. Why not?
c Why does the STREET item not appear on the query form?

.....................................................................................................................................................
2-19
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

Practice 2—4: Making a Module Component Reusable


Goal
This purpose of this practice is for you to make a module component reusable.

Scenario
The personal details module component will be used in other modules. To achieve this,
you need to make it reusable.

Your Assignment
Use the information below as your starting point:

Module MEM0010 – Maintain Personal Details

1 Check out the application system and module.


2 Make the CUS_MC module component reusable.
3 Change the reusable module component name to CUS_RMC.

.....................................................................................................................................................
2-20 Oracle Designer 6i: Web PL/SQL Design and Generation
Hints
.....................................................................................................................................................

Hints
Practice 2—1

To perform this task Follow these steps


To set the Generator 1 Select Options—>Generator Options—>Web PL/SQL.
Options
To generate a module 1 Expand the Modules tab in the Design Navigator.
Or:
Open a module diagram.
2 Select the module definition which you want to generate.
3 Select Generate—>Generate Module.
Or:
Click on the Generate icon in the toolbar.
To view files created 1 Invoke the Message Window after generation.
during generation of a 2 Select the List Actions button.
module 3 Double-click on a file name to view the file contents.

Practice 2—2

To perform this task Follow these steps


To install a module When the Generate dialog box appears:
automatically 1 Enter the application user account password.
2 Click on the button marked Options.
3 Enter the application user account name and database
connection string.
4 Select the Auto-install after Generation check box.
To install a module 1 Open a SQL*Plus session.
manually 2 Run the .sql file created during generation to install the
module packages. (Normally, you install it in the application
user account.)
To run a module 1 Run the browser.
manually 2 Enter the URL for the startup procedure into the location field.:
http://<webserver>:<port>/<agent>/
<implementation_name>$.startup

.....................................................................................................................................................
2-21
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

Practice 2—3

To perform this task Follow these steps


To open the Edit 1 Select Options—>Use Property Dialogs.
Module dialog 2 Highlight, in the Design Navigator, the module you want to
edit, or open the module diagram.
3 Carry out one of the following options:
– Click the Properties toolbar icon.
– Select Edit—>Properties....
– Right-click the module that you want to edit and select
Properties.
To find out about Click on the User Text tab in the Edit Module dialog.
module pages
To open the Edit 1 Select Options—>Use Property Dialogs.
Module Component 2 Highlight, in the Design Navigator, the module component you
dialog want to edit, or open the module diagram and select the module
component.
3 Carry out one of the following options:
– Click the Properties toolbar icon.
– Select Edit—>Properties....
– Right-click the module component that you want to edit
and select Properties.
To find out about Click on the User Text tab in the Edit Module Component dialog.
module component
pages

Practice 2—4

To perform this task Follow these steps


To check out objects 1 Select one or more objects from the Navigator.
2 Select Version—>Check Out...
3 Click OK.
To make a module 1 Right-click the module component you want to make reusable.
component reusable 2 Select Make Reusable.

.....................................................................................................................................................
2-22 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Instructor Notes

Class Management
Schedule
Timing Topic
22
40 minutes Lesson
G en erating W eb P L/S Q L M od u les
20 minutes Practice
60 minutes Total

Class Management
O verview
The lesson enables the students to generate a


H o w d o I g en erate and in stall a m o d u le?
H o w d o I run a m od ule?
basic module and understand the various pages
• W h at is gen erated ? that are generated in response to the module
table usages.

2-2

About the Slide


G enerator O ptio ns
This slide has a complex build to highlight
Location of
source files each part of the dialog.
Location of
target files

U ser account
Demo
A uto -install
optio n
Invoke your Generate Options dialog and fill
B row ser
URL in all the options. They are already set up for
2-4
the students.
Explain the difference between using ORA01
and ORA01/ORACLE in the Name field. (If
you do not give the password, you must enter it
into the Generate Web PL/SQL dialog to
enable automatic installation.)
About the Slide
G en erating M o d ules
This slide illustrates the various methods of
invoking the Generate Web PL/SQL dialog.
G enerate Too ls O ptions
G enerate M odule...
G en erate M odu le A s...

G en erate Da taba se from S erver M od el...


G en erate Da taba se A dm inistration O bjects...

G ene rate Table A P I...

G een
nerate
era te W eb P L/S
L/SQQL

M odule M EM 00 10
Includ e M odule N etw ork?

P ost G eneration
C om m it R evert B ro w se/E dit m ode

S tart O ptions C ancel H elp

2-5

.....................................................................................................................................................
2-23
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

About the Slide


G enerator D ialo g B o x
Point out that the password is highlighted if
G enera te W eb P L/S Q L
you have omitted the password on the Options
M odule nam e M odule M E M 00 10

Includ e M od ule N etw o rk?


dialog.
S elect to gene rate
entire m odule
netw ork P ost G eneration Point out the access to the Generator Options
C o m m it R evert B row se/E d it m ode

S tart O ptio ns C ancel H elp


dialog.

2-6

Class Management
G en erator In p uts
We do not teach a lesson on preferences as
G enerator
such; preferences are mentioned as they are
preferen ces

required in each section. They should have an


M odule
definition
understanding of preferences from First Class.
If this is not so, you may need to take a minute
M odu le
netw o rk
in the next lesson to revise.
2-7
The class should have been introduced to a
module network in First Class, if not, revise
the concept briefly.
Class Management
G enerator O utp u t F iles
.P K S and .P K B files
You do not need to spend long on this slide, but
• M od ule s tartu p
p ackag e
it may be useful to describe the files on a white
• M od ule c om po nen t
p ackag es board.
.S Q L file
B row ser:

http:// Technical Note


You can select multiple modules for generation
2-8
only in the RON. You can also generate several
modules using the module network.
Class Management
Installin g the A pp lication

• S elect auto -in stall after g en eratio n


You can demonstrate this slide and the next.
or
• D o u b le-click to in s tall
B uild A ction
D esc ription R un
Install G enerated packages in user
C ancel
R un generated application
V iew package specification
V iew package b ody
H elp

or
• In stall m an u ally fro m .S Q L file

2-9

.....................................................................................................................................................
2-24 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Class Management
R un nin g th e A p p licatio n

• D o u b le-click to ru n
B uild A ction
D esc ription R un
Install G enerated packages in user
C ancel
R un generated application
V iew package specification
V iew package b ody
H elp

– Invo kes th e b ro w ser


– N avig ates to th e m o d ule U R L
2-10

About the Slide


R u nn ing a M o du le M an u ally
The slide uses animation to pick out the parts
P L/S Q L entry
p rocedure
of the URL.
agent n am e

http://m
m yServer/myAge
yServer myAge
myServer nt/customers$.
myAgent cu stom ers$ startup
nt customers$ star tup

W eb server m odule
Demo
im plem entation
nam e
Invoke a browser and input a URL similar to
the one in the slide.
2-11

Practice
It would be a good idea to do practices 2—1
and 2—2 at this point. The students will then
understand about generation before you
discuss the page structure.
Class Management
M od ules and W eb P ag es
It is useful to show that one module produces
M od ule D esign
all these pages.
The About Page and Startup Page are created
A bout P age Q ue ry
Form R ecord
G enerated
W eb pages
for every module, even if there are no table
S tartu p P age List V iew
Form In sert
Fo rm
usages. The rest of the pages are dependent on
the table usages.
2-13

You can show the group the User Text tabs for
the module and the module component. This
shows the pages that exist at module level and
those that exist at module component level.
Class Management
M o du le D iagram V iew s

D a ta V iew D isplay V iew


There are many methods of creating a module,
the notes give one approach.

About the Slide


Compare what you see in each view.

2-14

.....................................................................................................................................................
2-25
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

Class Management
M od u le C om p onen t Typ es

M odule D iagram - C U S TO M E R S
You can create a reusable module component
M E M 0010
C U S _M C
S pecific from scratch in the reusable module
M odule C om ponent

R eusable M odu le C om ponent - C U S _M C R


W G _C U S TO M E R S
component branch. You can also create a
C us_Id C U S _M C R R eusab le
Last_N am e M odule C om ponent module component as part of another module
... W G _C U S TO M E R S
C u s_Id
La st_N am e and make it reusable.
....

You can only change the placement and usage


2-15
sequence for reusable module components.
You can drag a reusable module component
into a new diagram or use a button on the
diagram to include it. If you need to change
one property of a reusable module component
in a specific module, make the module
component a private copy.
Summary
S um m ary
Ensure that the students close all browser
• W eb P L /S Q L G ene rato r o p tio n s
• D esign E d ito r: sessions before you start the practice. In the
– C reate a m o du le
– G en erate a m o d u le last practice they used the completed version
– In stall a m o d ule auto m atically
• M an u al in sta llatio n o f a m o d u le of the application with the demo user. If they
• M o d ule stru cture an d g e nerated p ag es
• R eu sab le m o d u le co m p o n en ts do not shut down their browsers, the cache
keeps the connection information and they
2-16 continue to use the demo account.
Practice 2—1
Ask the students to write down the Web server access information in the table—they
will need it for the other practices. The first work area is mentioned specifically in
this practice. Ensure that the students do not install the packages automatically. After
generation, they have to examine the files.
Practice 2—2
The students must invoke SQL*Plus directly and execute the script file to install the
packages. They can then run the installed packages.

Practice 2—3
This practice gives the students a preliminary look at a very simple module in the
Design Editor, so that they can see where all the generated pages come from.

Practice 2—4
This practice asks the students to make a module component reusable so that it can
be used in a later module.

.....................................................................................................................................................
2-26 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Post Lesson Teaching Evaluation
.....................................................................................................................................................

Instructor Post Lesson Teaching Evaluation


Name: Full Email:

Course Name: Oracle Designer 6i: Web PL/SQL Design and Generation
Lesson number: 2
Number of teaches before filling this form: 1 - 2 - 3 to 5 - >5

Global comments: (circle all that apply)


• Lesson content: Trivial - Too easy - OK - Difficult - Too difficult
• Slide content: Too many slides - Too few slides - O.K
• Text content.Too much text - Not enough text - Unclear - O.K.
• Practice content: Too difficult - Too easy - Problems - O.K.

Detail comments
Content type: Slide - Text - Practice - Instructor notes
Note: 1:needs animation - 2:too much animation - 3:needs more text - 4:too much text
- 5:Unclear - 6:not necessary - 7:Other

Content Page
Note Comments/Suggestions
Type Number

Photocopy this page and fax to: Oracle Designer Curriculum Development @ +(44) 118.924.5181
Additional sheets are available at the end of the instructor’s guide.
If you draw additional diagrams on the white board use the Graphic sheet in the Instructor Evaluation
section at the end of this book.

.....................................................................................................................................................
2-27
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

.....................................................................................................................................................
2-28 Oracle Designer 6i: Web PL/SQL Design and Generation
Suggested Graphics
.....................................................................................................................................................

Suggested Graphics
Instructor name: Full email:

Course Name:Oracle Designer 6i: Web PL/SQL Design and Generation


Lesson No: 2 Page No:
Please sketch your additional diagram below.

.....................................................................................................................................................
2-29
®
Lesson 2: Generating Web PL/SQL Modules
.....................................................................................................................................................

Oracle Designer Education Products


Curriculum Development
520 Oracle Parkway
Thames Valley Park
Reading
Berkshire
England

fold here

.....................................................................................................................................................
2-30 Oracle Designer 6i: Web PL/SQL Design and Generation
3
.................................

Setting Up the Generation


Environment
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

Introduction
In this lesson you learn about setting up the correct environment for generating a Web
PL/SQL module. You also learn about the output produced by the Web PL/SQL
Generator.

Class
Overview Management
See Page 19

• What steps do I take before generating?


• What else do I need to install before generating?
• What is generated?

3-2

Topic See Page


Introduction 2
Preparing for Generation 4
Investigating the Web PL/SQL Toolkit 5
Using the Web PL/SQL Generator Library 7
Understanding the Table API 9
Building and Generating the Table API 11
Pre-Generation Check List 13
Summary 14
Practice 3—1: Generating the Table API 15
Practice 3—2: Investigating the Web PL/SQL Toolkit 16
Practice 3—3: Investigating the Generated Code 17

.....................................................................................................................................................
3-2 Oracle Designer 6i: Web PL/SQL Design and Generation
Introduction
.....................................................................................................................................................

Objectives
At the end of this lesson you should be able to do the following:
• Generate the table API to support a Web module
• Distinguish Web PL/SQL Toolkit and Web PL/SQL Generator Library program
calls in generated Web PL/SQL code
• Identify table API procedures in generated Web PL/SQL code

.....................................................................................................................................................
3-3
®
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

Preparing for Generation


You need to complete a number of steps before you attempt to generate a Web
PL/SQL module.
About this Slide
Preparing for Generation See Page 19
• Install and configure an Oracle Web Server Class
• Install the Web PL/SQL Toolkit Management
• Install the Web PL/SQL Generator Library See Page 19
For each module:
• Create the module design
• Generate the Table API
Web PL/SQL
Toolkit

Web PL/SQL
Table Generator
API Library
(WSGL)
Module Design
3-3

The Web server is usually installed by an administrator. There is a choice of Oracle


Web server products. The Web PL/SQL Toolkit is usually installed as part of the Web
server.

.....................................................................................................................................................
3-4 Oracle Designer 6i: Web PL/SQL Design and Generation
Investigating the Web PL/SQL Toolkit
.....................................................................................................................................................

Investigating the Web PL/SQL Toolkit


The Web PL/SQL Toolkit is part of an Oracle Web Server setup. It consists of a set of
packages that produce HTML code. These packages are used by the Web PL/SQL
Generator to produce your applications.

About this Slide


Web PL/SQL Toolkit See Page 20

• Consists of PL/SQL packages that produce


dynamic HTML
• Installed as part of an Oracle Web server setup
• Used by the Web PL/SQL Generator to build
application packages
• Enables PL/SQL programmers to write HTML

3-4

When Is the Web PL/SQL Toolkit Installed?


You install the Web PL/SQL Toolkit during installation of the Web server or as a
separate action once you have installed the Web server.

How Is the Web PL/SQL Toolkit Used?


The Web PL/SQL Generator uses the Web PL/SQL Toolkit to provide standard
functionality for Web applications implemented as a set of HTML pages.

What Are the Benefits of Using the Web PL/SQL Toolkit?


• The Web PL/SQL Generator creates packages with calls to the routines in the Web
PL/SQL Toolkit to build the application layout and functionality. Without the Web
PL/SQL Toolkit, these routines would have to be created for each individual
application. The toolkit is therefore a set of reusable routines for Web applications.
• PL/SQL programmers can use their existing skills when using the Web PL/SQL
Toolkit to embed HTML tags in PL/SQL procedure and function calls.

.....................................................................................................................................................
3-5
®
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

Web PL/SQL Toolkit Packages


The Web PL/SQL Toolkit consists of a number of packages that produce dynamic
HTML.

Class
Web PL/SQL Toolkit Packages Management
See Page 20

• HTP: Hypertext procedures that generate HTML Demo


tags See Page 20
• HTF: Hypertext functions that pass HTML values to
other subprograms
• OWA: Subprograms required by the PL/SQL
cartridge
• OWA_UTIL: Utility subprograms

3-5

• The HTP procedures generate HTML tags to create dynamic Web pages.
• The HTF functions pass HTML values to subprograms. You typically use them in
nested calls.
• The OWA subprograms are used by the PL/SQL cartridge.
• The OWA_UTIL subprograms perform such operations as getting the value of
CGI environment variables.
For a full list of toolkit packages see:
http://technet.oracle.com

.....................................................................................................................................................
3-6 Oracle Designer 6i: Web PL/SQL Design and Generation
Using the Web PL/SQL Generator Library
.....................................................................................................................................................

Using the Web PL/SQL Generator Library


Modules generated by the Web PL/SQL Generator make calls to the routines
contained in the Web PL/SQL Generator Library (WSGL). These packages are part of
Oracle Designer but you install them separately.

Web PL/SQL Generator Library

• Consists of standard code used by Web PL/SQL


applications
• Installed manually
• Includes calls to the Web PL/SQL Toolkit
• Used by the Web PL/SQL Generator to build
application code

3-6

Why Have a Library?


Some of the functionality in a generated application is common across all modules, for
example, building the query form or record list. Instead of including the code for these
tasks in every generated module, the development team has packaged the code into a
series of library packages called the WSGL. The generator makes calls to these library
routines when generating the Web PL/SQL module packages. Routines in the WSGL
use procedures and functions in the Web PL/SQL Toolkit.

Installing the Library


The library should be installed into, or be accessible from, every application user
account in which you have installed the application packages produced by the
generator. If there are several application user accounts, you may prefer to create a
library account to avoid duplicating the library for each account.
The WSGL can be installed in one of two ways:
• Execute the following script from SQL*Plus:
SQL>start $ORACLE_HOME\cgenw61\cvwetc\wsgl.sql
• Select Start—>Programs—>Oracle Designer 6i—>Install Web PL/SQL
Generator from your Windows desktop.

.....................................................................................................................................................
3-7
®
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

WSGL Packages
The WSGL consists of a number of packages which perform standard operations for
Web PL/SQL applications.

Class
Web PL/SQL Generator Management
Library Packages See Page 21

• WSGL: Layout of generated pages Demo


• WSGLM: English language strings for buttons, See Page 21
error messages, and captions
• Languages: French, German, Spanish and others
• WSGJSL: JavaScript functions
• WSGFL: Colors
• WSGOCOL: Oracle ConText functionality

3-7

• The WSGL procedures control the layout of generated pages.


• The WSGLM procedures provide language support for buttons, error messages
and captions. There are several different versions of this package giving support in
different languages. The file WSGLM.PKS holds the English language version. A
suffix on the filename indicates that there are other language versions. For
example, WSGLMD.PKS is the German language version.
• The WSGJSL procedures support the use of JavaScript in generated modules.
• The WSGFL procedures control the display of colors on generated pages.
• The WSGOCOL procedures enable you to incorporate Oracle ConText Cartridge
functionality into Web PL/SQL applications.

.....................................................................................................................................................
3-8 Oracle Designer 6i: Web PL/SQL Design and Generation
Understanding the Table API
.....................................................................................................................................................

Understanding the Table API


The Table Applications Programmatic Interface (API) consists of PL/SQL Packages
(table handlers) that can be called by client applications to perform Data Manipulation
Language (DML) operations on tables.

About this Slide


Maintain Data Through the Table API See Page 21

Browser:
http:// Insert
Table API
Update
Packages
Delete
Lock

CUSTOMERS
Insert
CTR_ID
Update LAST_NAME
Delete ...
Lock

3-8

DML in Web Applications


The Web browser cannot validate the data entered by the user or access the database
tables directly. Web applications must, therefore, use the table API to interact with the
database.
The table API carries out the following tasks:
• Validates data that is being inserted or updated, such as checking that mandatory
values are provided, or that a value is an allowed value or is part of a domain
• Populates columns that have a default value or that get their value from a sequence
• Converts text columns to uppercase, where required
• Handles constraint errors (you can substitute personalized error messages for the
server-derived ones)
• Populates journal tables
• Maintains denormalized or derived columns

.....................................................................................................................................................
3-9
®
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

What Does the Table API Look Like?


The Table API Generator creates a package for each table, with a naming convention
of CG$<tablename>, for example, CG$CUSTOMERS.

Table API Handler


Table
CUSTOMERS Package CG$CUSTOMERS

INS INSERT Procedure

UPD UPDATE Procedure

DEL DELETE Procedure

LCK LOCK Procedure

3-9

An API package for a specific table contains procedures that perform standard DML
operations on that table:
Procedure Operation
INS Inserts a new row
UPD Updates an existing row
DEL Deletes an existing row
LCK Locks an existing row

The other procedures in the table handler are used for validation and maintenance.

.....................................................................................................................................................
3-10 Oracle Designer 6i: Web PL/SQL Design and Generation
Building and Generating the Table API
.....................................................................................................................................................

Building and Generating the Table API


Before you generate a Web PL/SQL module, you need to generate the table API for
any table that the module uses.

Class
Generating Table API Management
See Page 22

Generate Tools Options Demo


Generate Module...
Generate Module As... • Invoke from Design See Page 22
Generate Database from Server Model... Editor
Generate Database Administration Objects...
Generate Table API...
• Generates packages
for tables
Generate Module Component API…
Generate Reference Code Tables...

Capture Design Of
Capture Application Logic...

3-10

You invoke the Generate Table API utility from the Design Editor. It uses the
repository definitions of the tables to generate the API. If you alter the definition of a
table after generating its API, you must regenerate the table API. You can create table
APIs for multiple tables during the same run.

.....................................................................................................................................................
3-11
®
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

The Generate Table API Options

Generate Table API Dialog


Target Objects

Target for Generation

Generate to File File

Database

or Database

File Prefix
Enter File Prefix
Directory
and Directory Browse

Stop on error

Stop on warning

Generate Table API Triggers

Upload generated files to repository

Start Cancel Help

3-11

The Generate Table API utility generates the table API packages to file.
If you select the Database radio button, the packages are automatically installed in the
database. You must enter the Oracle user name, password, and connect string for the
application user account into the appropriate fields in the Generate Table API dialog.
If you do not select the Database radio button, you must install the packages manually
in the database.
The generated packages are written to the directory you specify in the lower part of the
Generate Table API dialog. You can also specify a file name prefix.
For each table selected, the Generate Table API Utility generates the following files:
• A .pks file containing the package specification.
• A .pkb file containing the package body.
• A .sql file containing the execution script for the table API package body and
package specification.
When you run the .sql file (either by selecting auto-install or by running it
manually), a log file is created in your ORACLE_HOME\bin directory, or in your
working directory, if you have defined one. You inspect the log file to see if there are
errors when you compile the table API.

.....................................................................................................................................................
3-12 Oracle Designer 6i: Web PL/SQL Design and Generation
Pre-Generation Check List
.....................................................................................................................................................

Pre-Generation Check List


About the Slide
Pre-Generation Check List See Page 22

Web PL/SQL
WebServer Toolkit

Configure
Toolkit Schema WSGL

Data
design

Table
API
Table Owner
Schema

3-12

Ensure that you have:


• Installed the Web PL/SQL Toolkit and WSGL
• Generated and installed the Data Design
• Generated and installed the table API.

Installing the Web PL/SQL Toolkit and WSGL


Install the Web PL/SQL Toolkit and WSGL against the same user account. During
installation, public grants are automatically made for each package in the toolkit and
WSGL; public synonyms are also created for each package. This eliminates the need
to install the toolkit and WSGL for multiple users in the database.

Generating and Installing the Data Design


Generate DDL for the database design and install it into the application user account
using SQL*Plus. This is also the account used to store the generated packages for the
Web applications.

Generating and Installing the Table API


Generate the table API and install it into the application user account.
You are now ready to generate and install Web PL/SQL modules.

.....................................................................................................................................................
3-13
®
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

Summary

The Complete Picture


Web PL/SQL
WSGL
Toolkit

Builds module structure Builds query form, record list


and functionality and other standard functions

Generate
Browser:
http://

Table Hollywood

API

Maintains table data


3-13

Pre-Generation Checklist
You must install the following components:
• Web PL/SQL Developer’s Toolkit
• Web PL/SQL Generator Library packages
• Data design
• Table API

Generated Output
The generated module packages contain calls to the Web PL/SQL Toolkit and WSGL
to implement your module definition as a set of HTML pages. They also contain calls
to the table API to handle DML.

.....................................................................................................................................................
3-14 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 3—1: Generating the Table API
.....................................................................................................................................................

Practice 3—1: Generating the Table API


Goal
The purpose of this practice is for you to generate the API for a table and view it.

Scenario
You have generated and installed the module definition MEM0010 – Maintain
Personal Details that allows members to view and alter their details. Your job
is to review the pre-generation steps for this module. You begin by generating the table
API to file and viewing its contents.

Your Assignment
Use the information below as your starting point:

Wokarea Continue using the same workarea


Application System WG_HOLLYWOOD
Tool Design Editor
Module MEM0010 - Maintain Personal Details

1 Generate the table API for CUSTOMERS to a file. Enter your working directory
for the output files.
Note: You do not need to install the table API as this has been done for you. When
you generate the table API for this table, you should not generate the table API
triggers. In the CUSTOMERS table, the PHOTOGRAPH column is of type BLOB
which cannot be used in API triggers.
2 Answer the following:
a What are the names of the files?
b What is the name of the API package?

.....................................................................................................................................................
3-15
®
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

Practice 3—2: Investigating the Web PL/SQL Toolkit


Goal
The purpose of this practice is for you to view the code contained in the Web PL/SQL
Developer’s Toolkit.

Scenario
When you generate a Web PL/SQL module, the generated code includes calls to the
Web PL/SQL Toolkit. You will investigate the contents of these packages.

Your Assignment
Use the information below as your starting point:

Module MEM0010 - Maintain Personal Details

1 Open the file tk_ref.pdf, which is in the refs folder in your working directory,
and answer the following questions:
a What is the purpose of the HTP package?
b Name the procedure in the HTP package used to display text in italics.
c Name the procedure in the HTP package used to display a horizontal line.

.....................................................................................................................................................
3-16 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 3—3: Investigating the Generated Code
.....................................................................................................................................................

Practice 3—3: Investigating the Generated Code


Goal
The purpose of this practice is for you to identify calls to the table API, Toolkit and
WSGL packages in the generated module code.

Scenario
All module pre-generation checks are complete. You now need to view the generated
code to identify calls to the table API, Toolkit and WSGL.

Your Assignment
Use the information below as your starting point:

Module MEM0010 - Maintain Personal Details

1 In the online help, search for WSGL.


aWhat is the general purpose of the WSGL package?
b What is the general purpose of the WSGFL package?
2 In your working directory, open the generated package body file for module
MEM0010 (cvwpersonal.pkb) and answer the following questions:
a How do you know which code relates to the table API?
b Find a line of code that calls the table update procedure.
c How do you know which code relates to the WSGL?
3 The Customer Id displays in red when you run the module.
a Can you find the line of code that implements this feature?
b Which Web PL/SQL Generator Library procedure is used to achieve this?

.....................................................................................................................................................
3-17
®
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

Hints
Practice 3—1
To perform this task Follow these steps
To generate the table 1 Select Generate—>Generate Table API.
API to a file 2 Select the File radio button.
3 Enter the file prefix and directory path.
4 Select the Objects Tab and expand Relational Tables.
5 Select the table and click the single arrow button (use the
double arrow to select all tables).
6 Click the Start button.
To view generated 1 Select the List Actions iconic button from the Messages
files Window or select Messages—>Build Actions.
2 Select a file from the list and click Run to view it.

Practice 3—2
There are no hints for this practice.

Practice 3—3
There are no hints for this practice.

.....................................................................................................................................................
3-18 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Instructor Notes

Class Management
We have called this lesson Setting Up the Generation Environment but we also look
at the code for a generated module to help the student appreciate the need for the pre-
generation steps.

Schedule
Timing Topic
33
30 minutes Lesson
S ettin g U p th e G eneratio n En viro n m en t
20 minutes Practice
50 minutes Total

About the Slide


O verview
This lesson brings together all the steps


W h at s tep s d o I take befo re g e neratin g?
W h at e lse d o I n eed to in stall b efo re g en eratin g ?
required before generation, some of which can
• W h at is gen erated ? be completed by administrators.
Some of these steps involve installing PL/SQL
packages, which are identified in this lesson.
The student then views the generated code for
3-2
a module and identifies calls to these packages.

Class Management
We give only an overview of the contents of
the Web PL/SQL Toolkit and the WSGL. The
students can investigate the Toolkit in more
detail in their own time.
About the Slide
Preparin g fo r G en eration
• Install an d c o nfig u re an O racle W eb S erver The initial setup should be done by an
• Install th e W eb P L /S Q L T oo lkit
• Install th e W eb P L /S Q L G en erato r L ib rary administrator and should be handled once.
F o r each m od u le:


C reate th e m o d u le d esig n
G enerate th e Tab le A P I
The developer is responsible for building the
W eb P L/S Q L
Toolkit module and generating the Table API.
W eb P L/S Q L
Table
API
G enerator
Library
(W S G L)
Class Management
M odule D esign
3-3
Don’t teach each of the topics here. You should
see this as a signpost slide for the next section
of the lesson.
For this class, the WSGL, Toolkit, and Table
API have already been built for each student.

.....................................................................................................................................................
3-19
®
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

About the Slide


W eb P L/SQ L T o olkit
The Toolkit is part of the Web server setup. It
• C o n sis ts o f P L /S Q L pac kages th at p ro d u ce
d yn am ic H T M L
is usually installed against a single user


In stalled as p art o f an O racle W eb server setu p
U sed b y th e W eb P L /S Q L G en erator to b u ild
account. Public grants and synonyms are made
a pp licatio n p ackag es
• E n ab le s P L /S Q L p ro g ram m ers to w rite H T M L for each package in the toolkit. This eliminates
the need to install the Toolkit for multiple users
in the database. It is recommended that the
3-4 Toolkit is not installed for any other user in the
database. This is mentioned in the notes for a
later slide.
Class Management
W eb P L /S Q L To o lkit P ackag es
Don’t spend too long explaining these
• H T P : H ypertext p ro ced u res th at g en erate H T M L
tag s
packages as the students will practice this. Just
• H T F : H ypertext fu n ctio ns that pass H TM L valu es to
o th er s ub p ro g ram s make them aware of this external URL.
• O W A : S u bp ro gram s req u ired b y the P L /S Q L
c artrid g e
• O W A _U T IL : U tility su b p ro g ram s
Demo
There are two files from the OAS reference
3-5
information in the Refs folders (yours and the
students). TK_qref.pdf is the quick reference
guide and TK_ref.pdf is the full reference.
Class Management
W eb P L /SQ L G en erator L ibrary

• C o n sis ts o f stand ard co d e u sed by W eb P L/S Q L


a pp licatio n s
• In stalled m an u ally
• In clu d es calls to th e W eb P L /S Q L T o o lkit
• U sed b y th e W eb P L /S Q L G en erator to b u ild
a pp licatio n c od e

3-6

.....................................................................................................................................................
3-20 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Class Management
W eb P L /S Q L G en erato r
L ibrary P ackag es WSGL is specific to Designer. You must install


W S G L : L ayo u t o f g en erated p ag es
W S G L M : E n g lish lan gu a ge strin g s fo r b u tto ns,
it because the Web PL/SQL Generator uses

e rro r m essa ges, a nd cap tio n s
L an g u ag es: F ren ch , G e rm an , S p an ish an d o th ers
these packages during the generation of Web


W S G JS L : JavaS cript fu n ctio n s
W S G F L : C o lo rs
PL/SQL modules.
• W S G O C O L : O racle C o n T ext fun ctio n ality
It may be useful to point out here that the
Toolkit, WSGL, and other packages, such as
3-7
WSGJSL, must be accessible to the user at
runtime. That is, these procedures are all called
by the generated PL/SQL packages at runtime.

Demo
In Explorer, open WSGL.PKS from the working
directory. Briefly explain its contents. Don’t
spend too long on this as the students look at
these files during the practice.
About this Slide
M ain tain D ata Th ro u gh th e T ab le A P I

B row ser:
In most applications, the API removes code
h ttp :// Insert
U pdate
Table A P I
P ackage s
from the client and places it on the server, thus
D elete
Lock keeping the client “thin”.
CUSTOMERS
Ins ert
U p date
C TR _ID
LA S T_N A M E
For Web applications, the procedures can only
D e lete ...
Lo ck be on the server already. However, the table
API maintains the generic code in a single area
3-8
and the PL/SQL package for each module is
smaller.
Class Management
Tab le A P I H an d ler
Table
C U S TO M E R S P ack age C G $ C U S TO M E R S

IN S IN S E R T P rocedure

UPD U P D A TE P rocedure

DEL D E LE T E P rocedure

LC K LO C K P rocedure

3-9

.....................................................................................................................................................
3-21
®
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

Class Management
G en erating T ab le A P I
Mention the issue of generating Web pages for
G en erate
G e ne rate M o du le...
To ols O ptions

G e ne rate M o du le A s... • Invo ke fro m D esig n


views. The utility does not do that, so you must
G e ne rate D a tab ase from S erve r M od el...
G e ne rate D a tab ase A d m in istra tio n O b je cts...
G en erate T ab le A P I...

E d ito r
G en erates p ackag es create a table with the same definition as the
for tab les
G e ne rate M o du le C o m po ne nt A P I…
G e ne rate R e fere nce C ode Ta bles... view and generate the API for the table.
C a ptu re D esign O f
C ap ture A p plica tion Lo g ic...

Demo
3-10
It is probably easier to demo this slide and the
next.
Class Management
G en erate Tab le A P I D ialo g
Target O bjects

Target for G eneration

G enerate to File File

D atabase

or D atabase

File P refix
E nter File P re fix
D irectory
and D irectory B row se

S top on error

S top on w arning

G enerate Table A P I Triggers

U pload generated files to rep ository

S tart C a ncel H elp

3-11

About the Slide


P re-G en eration C h eck L ist
A number of schemas are recommended for
W eb P L/S Q L
W ebS erver To olkit
building Web applications. Refer to the About
C on figure
Toolkit S chem a W SGL schemas for Web PL/SQL applications topic in
D a ta the online help for the intended use of these
de sign

terms before teaching this slide.


Table
API
Table O w ne r
S chem a

3-12

.....................................................................................................................................................
3-22 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Class Management
Th e C o m plete P ictu re
W eb P L/S Q L
W SGL
Toolkit

B uilds m odule structure B uilds query form , record list


and functiona lity and other sta ndard function s

G en erate
B row ser:
http ://

Ta ble H o lly
llyww ood

API

M aintains table da ta
3-13

Practice
The students do not run any applications in this practice. It shows the pre-generation
steps and how the Toolkit, WSGL, and Table API are used in generated code.

Practice 3—1
The practice only requires that the class generate the Table API to file. If the students
wish to install the API they can do so, but make sure they do not generate the Table
API with triggers. If they do, they will need to drop the triggers before they run the
application. The before_update trigger fails for a table with a LONG, LONG
RAW, or LOB column.

Practice 3—2
The students are asked to refer to TK_ref.pdf.

.....................................................................................................................................................
3-23
®
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

.....................................................................................................................................................
3-24 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Post Lesson Teaching Evaluation
.....................................................................................................................................................

Instructor Post Lesson Teaching Evaluation


Name: Full Email:

Course Name: Oracle Designer 6i: Web PL/SQL Design and Generation
Lesson number: 3
Number of teaches before filling this form: 1 - 2 - 3 to 5 - >5

Global comments: (circle all that apply)


• Lesson content: Trivial - Too easy - OK - Difficult - Too difficult
• Slide content: Too many slides - Too few slides - O.K
• Text content.Too much text - Not enough text - Unclear - O.K.
• Practice content: Too difficult - Too easy - Problems - O.K.

Detail comments
Content type: Slide - Text - Practice - Instructor notes
Note: 1:needs animation - 2:too much animation - 3:needs more text - 4:too much text
- 5:Unclear - 6:not necessary - 7:Other

Content Page
Note Comments/Suggestions
Type Number

Photocopy this page and fax to: Oracle Designer Curriculum Development @ +(44) 118.924.5181
Additional sheets are available at the end of the instructor’s guide.
If you draw additional diagrams on the white board use the Graphic sheet in the Instructor Evaluation
section at the end of this book.

.....................................................................................................................................................
3-25
®
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

.....................................................................................................................................................
3-26 Oracle Designer 6i: Web PL/SQL Design and Generation
Suggested Graphics
.....................................................................................................................................................

Suggested Graphics
Instructor name: Full email:

Course Name:Oracle Designer 6i: Web PL/SQL Design and Generation


Lesson No: 3 Page No:
Please sketch your additional diagram below.

.....................................................................................................................................................
3-27
®
Lesson 3: Setting Up the Generation Environment
.....................................................................................................................................................

Oracle Designer Education Products


Curriculum Development
520 Oracle Parkway
Thames Valley Park
Reading
Berkshire
England

fold here

.....................................................................................................................................................
3-28 Oracle Designer 6i: Web PL/SQL Design and Generation
4
.................................

Designing Web PL/SQL


Modules
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

Introduction
After you have checked that the analysis information is complete, you can use the
Application Design Transformer to generate a set of modules based on the business
function information. You covered these topics in an earlier course, so we will not go
into any detail here.
This lesson covers the ways in which you can create modules as you begin your
application design. It also highlights some of the areas you should be aware of.

About this Slide


Overview See Page 31

• What must I do before building a module?


• How do I create a module?
• Which method should I use to create a module?

4-2

Topic See Page


Introduction 2
Preparing for Module Design 4
Establishing Display Standards 5
Creating Modules 7
Using the Application Design Transformer 8
Linking Table Usages in a Module Manually 9
Using the Default Links Utility 11
Creating a Module Semi-Automatically 13
Creating a Module Manually 15
Universal Generation 18
Creating a Web Module from a Form 19
Summary 20

.....................................................................................................................................................
4-2 Oracle Designer 6i: Web PL/SQL Design and Generation
Introduction
.....................................................................................................................................................

Topic See Page


Practice 4—1: Creating a Web Module Using the Semi-Automatic 21
Method
Practice 4—2: Creating a Web Module Manually 23
Practice 4—3: Creating a Web Module from a Captured Form 25

Objectives
At the end of this lesson, you should be able to:
• Transform functions into modules
• Create a module manually
• Create a module from a form

.....................................................................................................................................................
4-3
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

Preparing for Module Design


There are a number of ways to design and create the modules you need for your
application. You have already encountered some of these on an earlier course, so here
we just remind you of the methods and point out some areas to look out for.
About this Slide
Where Does It All Come From? See Page 31

Matrix
Functions Diagrammer Entities

Table Definitions

Modules

4-3

Check Function Definitions


You should check the following for all functions you intend to automate:
• Set the Response property to IMMEDIATE (online) or OVERNIGHT (batch) as
this property is used by the Application Design Transformer (ADT) to determine
the module type.
• Set entity data usages.
• Set attribute data usages.
You have been taught from a previous course that the Matrix Diagrammer can be used
to cross-check the data usages for each function.

Transform Entity Definitions and Define Database Objects


Use the Database Design Transformer (DDT) to transform your entity model to a first-
cut table design. You must then check that the database objects are fully defined in the
repository before creating modules.
Note: The server model should be generated onto a physical database before you
generate modules.

.....................................................................................................................................................
4-4 Oracle Designer 6i: Web PL/SQL Design and Generation
Establishing Display Standards
.....................................................................................................................................................

Establishing Display Standards


Once you have fully defined your database objects, you should decide how you want
to display data from your tables in generated applications.
.

Using Column Properties to Set


Standards

Review column properties before creating modules


Column properties Item properties
Action Edit Block Field

Other DB + X
Copies Action Edit Block Field
+ X
Customers:

Display type Display type


Sequence Display sequence
Default value Default value
Prompt Prompt
Optional? Optional?
... ...
4-4

What Are Column Display Properties?


The column display properties allow you to establish display standards before creating
modules. Think about how you want to display the data for each column in a table and
set the properties to match your requirements.
• To set a standard that is applied throughout an application, you should set the
display properties in the table. This standard then applies to all modules that use
the table.
• If the change is module-specific, you need only change the item display properties
in the module, as this does not affect the column display properties.
For example, if you want to display a column as a check box every time it appears in a
generated application, you can record that information once, against the column. A
check box is then used every time you build a module using that table. This saves you
having to set the check box display type in each module that uses the column.

Uses of Column Display Properties


You can use column display properties to perform tasks such as the following:
• Ensure every occurrence of TITLE has a prompt of Video Title.
• Decide the order in which items appear in a generated application.
• Define the way that columns are presented when they have a list of values (for
example, as a radio group or a poplist).

.....................................................................................................................................................
4-5
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

How to Set Column Display Properties


E.

About this Slide


Where to Set Display Properties See Page 32

Column Properties

Default Display
Display Type Text
Alignment Left
Display Length 60
Display Height 3
Display Sequence 20
...

Help
Hint A unique co

4-5

For a full list of column display properties, invoke the property palette:
1 Invoke the Design Editor.
2 Expand the Relational Table Definitions node.
3 Expand the table.
4 Expand the Columns node.
5 Invoke the property palette.
6 For each column, set the required values under the Default Display and Help
groups of properties.

.....................................................................................................................................................
4-6 Oracle Designer 6i: Web PL/SQL Design and Generation
Creating Modules
.....................................................................................................................................................

Creating Modules
During the design phase you can use different approaches and tools to create modules.
.
Class
How to Create a Module Management
See Page 32
Application Refine
Automated Design data
Transformer usages

Link Create
Semi- Link
modules default
Automated data
to data usages
functions usages

Define Define
Manual modules usages
manually manually

4-6

Automated
The Application Design Transformer (ADT) creates a first-cut application design. It
generates a set of modules based on the business function information defined during
analysis.

Semi-Automated
The Create Default Module Data Usages utility in the Repository Object Navigator
(RON) converts business function data usages into module data usages.

Manual
You create modules manually using the Design Editor.

.....................................................................................................................................................
4-7
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

Using the Application Design Transformer


As you have learned in an earlier course, unlike the Database Design Transformer
(DDT), you cannot use the ADT iteratively. You need not run the ADT for the entire
application system, instead you can run it for a branch.

About this Slide


Application Design Transformer See Page 32

• Uses:
– Function Hierarchy
– Business Units
• Produces:
– Module definitions
FHD
– Module table usages

Module

4-7

First-Cut Application Design


The ADT creates a first-cut module design from elementary function definitions and
business units. The ADT produces the following:
• One module component with a base table usage for each function:entity usage
defined.
• One bound item for each function:attribute usage defined.
The data usages define how a module uses tables and columns.

Refining Your Modules


Once you have created the first-cut design, you use the Design Editor to accept or
reject candidate modules and then refine these new Web PL/SQL modules.

.....................................................................................................................................................
4-8 Oracle Designer 6i: Web PL/SQL Design and Generation
Linking Table Usages in a Module Manually
.....................................................................................................................................................

Linking Table Usages in a Module Manually


Modules that have been generated by the Application Design Transformer have no
table usage links initially. You either establish these links manually or use the Default
Links utility.

Linking Module Components Manually

• Table usages must


exist
• Foreign key must
exist

• Link base table


usages
• Link base usage to
lookup usage

4-8

You can add two types of table link to your module:


• Base table links produce a master–detail relationship. This is achieved by linking
two module components which contain base tables. Base table links are
represented as vertical links in the module diagram data view.
• Lookup table links display additional information required to describe the foreign
key from the base table. The module must have a base table before you can create
a lookup table link. Lookup table links are represented as horizontal links in the
module diagram data view.
You therefore need to plan the overall structure of the module. You must determine:
• Which tables to use as the basis for the generated pages (base table usages).
• How you want the components sequenced.
• Which details are needed for each component that do not come from the base table
(lookup table usages).

Using the Diagram to Create master–detail Links


Display your module diagram in data view:
1 Sequence the module components to match your requirements. If they are in the
wrong sequence, select the module components (not the table usages) and drag and
drop them to the correct position using the horizontal dashed line as a guide.
2 Select the Key Based Link button from the module diagram toolbar.

.....................................................................................................................................................
4-9
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

3 Click once on each base table to create the link.

Using the Diagram to Create Lookup Links


Display your module diagram in data view:
1 Select the Create Table Usage button from the module diagram toolbar.
2 Click on the diagram to the right of the required base table using the vertical
dashed line as a guide.
3 Select the table and items required. You can also add a WHERE clause if required.

Converting Existing Links


• You can convert base table links to lookup links by dragging the base table usage
to the right of the base table that requires the new lookup using the vertical dashed
line as a guide.
• You can convert lookup links to base table links by dragging the lookup table
above the base table to which it is currently linked using the horizontal dashed line
as a guide. This automatically creates a new module component for the converted
lookup table, since a base table cannot exist without a module component.

.....................................................................................................................................................
4-10 Oracle Designer 6i: Web PL/SQL Design and Generation
Using the Default Links Utility
.....................................................................................................................................................

Using the Default Links Utility


The Default Links utility automatically generates module links to control how module
component table usages are used in generated applications.

About this Slide


Linking Module Components See Page 33
Automatically
Demo
• Parent links See Page 33
Generate Default Links
Parent Links
Find Parents
Find Second Parents ORDERS
Allow Lookup Parents
Allow Keys against Master Components
Keep Existing Links

Lookup Links
Create Table Usages for Descriptor Columns
Use Outer Joins ITEMS
Find Treewalk Links

OK Cancel Help

4-9

Requirements Before Using the Default Links Utility


You need to structure the module taking into consideration the following:
• The table usage sequence for base table usages
• Primary key column usages in Master base usages
• Foreign key column usages in:
– Detail base usage
– Any base usage supporting a lookup

Adding Parent Links


Select Find Parents to produce a master–detail relationship. The utility determines
which base table usages can become the parents of other base table usages. Where a
parent is found, a link is created between the detail base table usage and the nearest
parent above it on the module diagram.
If you have not included foreign key bound items in the detail base table usage, the
utility also creates them for you.

.....................................................................................................................................................
4-11
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

Adding Lookup Links


You can use the Default Links utility to create lookup links if you have first defined
descriptor columns in the database.

Demo
Linking Module Components See Page 33
Automatically

• Lookup links
Generate Default Links
Parent Links
Find Parents
Find Second Parents
Allow Lookup Parents
Allow Keys against Master Components
Keep Existing Links

Lookup Links
Create Table Usages for Descriptor Columns
Use Outer Joins
Find Treewalk Links

OK Cancel Help

4-10

What Is a Descriptor?
A descriptor is a database column that describes a primary key column in the same
table. A descriptor helps the user to identify the foreign key value.
You should set descriptors for all tables where the primary key value alone is
insufficient to identify the required value.

How Do I Set Descriptors?


The Descriptor Sequence property is available for every column. If you need more
than one descriptor in a table then this number indicates the order in which the
descriptor items appear in the generated application.

How Do I Add Lookup Links?


Once you have set descriptors for your tables, select Create Table Usages for
Descriptor Columns from the Default Links utility to automatically create lookup
links. Lookup links are created for each base table in your module that has a foreign
key bound item referencing a primary for which you have defined descriptors. The
descriptor columns are also added as displayed bound item usages.

.....................................................................................................................................................
4-12 Oracle Designer 6i: Web PL/SQL Design and Generation
Creating a Module Semi-Automatically
.....................................................................................................................................................

Creating a Module Semi-Automatically


You can use a combination of manual and automatic procedures to build a module.
The Create Default Module Data Usages utility allows you to add module
components, table usages and bound items to an existing module based on your
business function definitions.
You must create a module before you can use the utility to add module data usages.
This utility can only be run from the RON, so you should create the module in the
RON instead of in the Design Editor.
About this Slide
Semi-Automatic Method See Page 34
• Create a module in the RON and associate with Demo
one or more business functions
See Page 34

4-12

Creating a Module in the RON


1 Select the Modules node.
2 Select Edit—>Create from the menu.
3 Provide the module information by setting the module properties in the Module
Properties window.
Note: The Language property must be defined (for example, Web PL/SQL).

Associating a Module with a Business Function


1 In the RON, expand the module.
2 Expand the Usages node.
3 Select the Implementing Business Functions node.
4 Select Edit—>Create Reference from the menu.
5 Select one or more business functions and click OK.

.....................................................................................................................................................
4-13
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

About this Slide


Semi-Automatic Method See Page 34
• Run the Create Default Links Utility Practice
See Page 34

4-13

Creating the Data Usages


1 In the RON, select the module.
2 Select Utilities—>Designer—>Create Default Module Data Usages from the
menu.
3 Close the utility when it has finished.
Like the ADT, this utility creates:
• A module component with a base table usage for each function:entity usage
defined.
• A bound item for each function:attribute usage defined.
Like the ADT, this utility does not create any module links. It is therefore your
responsibility to add any required links to the module using one of the methods
described earlier.

.....................................................................................................................................................
4-14 Oracle Designer 6i: Web PL/SQL Design and Generation
Creating a Module Manually
.....................................................................................................................................................

Creating a Module Manually


You can use the Design Editor to create module definitions and to refine module
definitions created by the Application Design Transformer.

Module Properties

Creating New Modules

Unique and
mandatory

WG_Holly_01 Module Properties


Application Owner WS_HOLLY
Short Name EMP0100_W
Name Employees
Language Web PL/SQL
Purpose ...
Implementation Name EMP

Used in the URL

4-16

Complete the following properties for the new module:

Property Description
Short Name The short name of the module, which must be unique
Name A descriptive name for the module, which can be the same as the Short
(Module Name) Name but must be unique between modules
Purpose Text to describe the purpose of the module (The dialog box provides a
period (.) for quick module creation since this is a mandatory property.)
Language The language of the module, for example, Web PL/SQL. The System
Folder contains a predefined set of languages that you can use.
The module dialogs only display tabs that are specific to the Web
PL/SQL Generator when you edit a module with the language set to Web
PL/SQL.
Type DEFAULT (screen) or MENU
The generator does not produce PL/SQL for modules with a type
of Menu. However, the generator does use menu modules to affect
the screen modules that own them. Menu modules are discussed in
more detail in a later lesson.

.....................................................................................................................................................
4-15
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

Certain module properties are not mandatory, however you should give meaningful
values to the module properties described below.

Property Description
Top Title This is the default title for the module startup page.
The text you enter for this property is also used for hyperlinks to
this module if you set the Menu Style preference (MODMNS) to
LONG TITLE.
Short Title The text you enter for this property is used for hyperlinks to this
module if you set the Menu Style preference (MODMNS) to
SHORT TITLE.
If you do not define a Top Title, the Short Title is used as the
default title for the module startup page.

These properties are covered in more detail later in the course.

.....................................................................................................................................................
4-16 Oracle Designer 6i: Web PL/SQL Design and Generation
Creating a Module Manually
.....................................................................................................................................................

Module Component Properties

Module and Component Properties

Module Language
Type

Module Component Insert, update, and


delete operations
Query
Layout style

4-17

The Layout Style controls the overall appearance, content and sequence of the
generated pages for each module component.
You set the allowable operations (insert, update, delete and query) at module
component level.
Practice
Table Usages See Page 35

• Module component table usages control:


– Display WG_Holly_01 Module Properties
– Insert Operations
– Update Insert? Yes
Update? Yes
– Query
Delete? No
Query
Query? Yes
• Lookup table usages provide:
– Descriptor information
– Additional validation

4-18

.....................................................................................................................................................
4-17
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

Universal Generation
A powerful feature of Oracle Designer is the ability to generate a single module
definition with a number of different generators. For example, you can use the Web
PL/SQL Generator to generate a module that is defined as a Form module.
If you select Generate—>Generate Module, the dialog only lists the modules with
the appropriate language for the generator you invoked.
If you select Generate—>Generate Module As..., the dialog lists all available
generators.

Using Existing Modules

• Generate an existing or captured:


– Form Builder module
– Report Builder module
– Visual Basic module
. . . as a WebServer module

Use the Copy with New Language utility

4-20

If you want to generate a module to a different target language, you may want to use
the Copy With New Language utility to create a copy of it. This is because not all
parts of a module definition are used by all generators and certain parts may be used in
different ways.
Complete as much of the module definition as is generic in one module definition. You
can then copy the module as many times as necessary and complete the remaining
portion of each module appropriately for that module’s language.

.....................................................................................................................................................
4-18 Oracle Designer 6i: Web PL/SQL Design and Generation
Creating a Web Module from a Form
.....................................................................................................................................................

Creating a Web Module from a Form


You can capture existing forms into the repository and convert them to Web PL/SQL
modules.

Migrating a Form to the Web


Browser:
Action Edit Block Field http://

Customers:
Hollywood

Web PL/SQL
Form
Application

• Capture the Form into the Repository


• Change the Module Language
• Refine the module definition
• Generate the module

4-21

1 Use the Design Capture utility to capture the form definition into the repository.
You invoke the utility by selecting Generate—>Capture Design of—>Form...
in the Design Editor. When you capture the design of an existing form, you
capture the module design, including:
– Module definitions
– Base table usages
– Column usages
– Lookup table usages
– Item prompts
– Application logic (you would need to rework the logic to appropriate Web
events)
2 Change the Language of the module and the module component to Web PL/SQL
Hint: If you use the property dialog to change the module language, the module
component language is automatically updated at the same time.
3 Refine the module definition in the Design Editor.
4 Generate the module.
Note: You may also need to generate the Table API for the tables used by the captured
module.

.....................................................................................................................................................
4-19
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

Summary

Summary

Create Web PL/SQL modules:


• Automatically using the Application Design
Transformer
• Semi-automatically from business functions
• Manually:
– Design Editor
– Copy Module utility
– Capture Design utility

4-22

Designing Web Modules


The benefits of good design make it worth your while to spend the required time
designing your application system.

Web Module Sources


Web PL/SQL modules are created in the same manner as any Oracle Designer module.
You create them with the Application Design Transformer, the Create Default Module
Data Usages utility in the RON, by capturing the design of existing applications or by
creating them manually.
• Use the ADT for the first-cut design.
• Use the Create Default Module Data Usages utility to create small sections of the
system.
• Create modules manually for prototype and test applications.
• Capture the design of modules to migrate a legacy system.

Module Definitions
The Web PL/SQL Generator generates modules with a language of Web PL/SQL and a
type of Screen or Menu. Module titles are used to name the generated modules on the
Web.
Module components consist of one base table usage and its lookups. You can link
module components to create master–detail relationships. Ensure that you define your
table usage flags and column usage flags appropriately before generating the module.

.....................................................................................................................................................
4-20 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 4—1: Creating a Web Module Using the Semi-Automatic Method
.....................................................................................................................................................

Practice 4—1: Creating a Web Module Using the Semi-


Automatic Method
Goal
The purpose of this practice is for you to create a first-cut Web PL/SQL module using
the semi-automated method.

Scenario
The developers have decided that customers should be able to rent videos online.
Using this module, a customer can view the videos they have rented.

Your Assignment
Use the information below as your starting point:

Workarea Continue using the same workarea


Tool Function Hierarchy Diagrammer (FHD)
Repository Object Navigator (RON)
Design Editor
Module REN0010 - Review/Book Rentals

1 Start the FHD and open the APPLICATION HIERARCHY diagram.


2 View the properties of the RENT09 – Review/Book Rental function.
3 Based on the Short Definition of this function, should the Response be set to
IMMEDIATE (online) or OVERNIGHT (batch)? Set the property if necessary.
4 Familiarize yourself with the data usages for this function. Close the property
dialog and exit the FHD when you have finished.
5 In the RON, check out the application system and create a new module called
REN0010.

Property Value

Module Short Name REN0010


Module Name REVIEW/BOOK RENTALS
Language Web PL/SQL
Implementation Name rental

6 Assign the RENT09 business function to the module.


7 Does the module currently have module components or table usages?
8 Run the utility that automatically creates data usages for the module.

.....................................................................................................................................................
4-21
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

9 Requery the module. What additional information does it now have?


a What are the names of the module components?
b How did the utility know to create the table usages?
10 Close the RON.
11 Return to the Design Editor and create a diagram of the module REN0010.
12 Using the diagram, create the links between the table usages such that
RENTAL_ITEMS is the detail module component for the master, RENTALS
(ensure RENTALS appears above RENTAL_ITEMS).
13 Add lookup information to the module:
a RENTALS needs MEMBERSHIPS as a lookup that excludes organizations
and displays the IDENTIFIER and CURRENT_START_DATE columns.
b RENTAL_ITEMS needs COPIES as a lookup that displays the CPY_ID,
TTE_PRODUCT_CODE and SHELF_CODE columns.
14 Can you see any other information that might also be suitable as displayed lookups
for each of the base tables? You add this information in a later lesson.
15 Make the primary key lookup items nondisplayed.
16 In Display View, put the items in sensible sequences.
17 Add more suitable prompts, widths, and heights, if necessary.
18 What operations have been set for the RENTALS module component? Where did
these values come from?
19 Set the generation options to install modules automatically.
20 Generate, install and run REN0010.
a Click the Find button to query Rentals.
b Select an individual rental to navigate to the view form.
There is a link to rental items from the view form. Do not use this link as we
will alter the structure of this module in a later lesson so that rental items are
viewed with the rental.

.....................................................................................................................................................
4-22 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 4—2: Creating a Web Module Manually
.....................................................................................................................................................

Practice 4—2: Creating a Web Module Manually


Goal
The purpose of this practice is for you to create a Web PL/SQL module manually.

Scenario
Customers should be able to join and to renew or update their membership details
online. The customers should therefore be able to query their existing memberships,
insert new memberships and renew or update their details. You are required to set
appropriate column display properties and set the following rules:
• For an existing membership, the customer must enter their membership id into the
query form to return their details for viewing or amendment. The membership id is
the only queryable item.
• Membership Periods should be displayed in order of Start Date.
• The descriptor columns for customers are the identifier, the first name, and the last
name.
The following diagram shows how the tables are related in the server model:

Your Assignment
Use the information below as your starting point:

Module MEM0020 - Maintain Memberships

1 What operations do you need for each table and its items?

.....................................................................................................................................................
4-23
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

2 Create the MEM0020 module using the following information:

Property Value

Module Short Name MEM0020


Module Name MAINTAIN MEMBERSHIPS
Language Web PL/SQL
Top (startup page) Title Maintain Memberships
Implementation Name member

3 Create the MEM_MC module component based on the MEMBERSHIPS table (do
not include the CUSTOMERS lookup yet).
a Use the Module Component dialog to add an appropriate title, set the
operations and display the columns (all except OGN_NAME).
b Set the Membership Id as the only queryable item.
c Ensure that only customers are retrieved (not organizations).
4 Create the MPER_MC module component based on the
MEMBERSHIP_PERIODS table:
a Include all the columns.
b Set the order by sequence for the rows.
5 Run the utility to link MEMBERSHIPS and MEMBERSHIP_PERIODS and to
create the CUSTOMERS lookup. Is there anything you should do before running
the Default Links utility to create the lookup?
Hint: You do not need to run the utility twice.
6 Make the primary key lookups nondisplayed.
7 Sequence the lookup items after the foreign key bound items in both module
components.
8 Generate, install and run the module.

.....................................................................................................................................................
4-24 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 4—3: Creating a Web Module from a Captured Form
.....................................................................................................................................................

Practice 4—3: Creating a Web Module from a Captured


Form
Goal (See Page 35)
The purpose of this practice is for you to capture the design of a form and generate it
as a Web PL/SQL application.

Scenario
You would like to implement a new application on the Web allowing customers to
reserve video titles. This application currently exists as an Oracle Form so to save time
you use it as a starting point.

Your Assignment
Use the information below as your starting point:

Module REN0020 - Reserve a Title

1 The Titles form looks like this:

.....................................................................................................................................................
4-25
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

2 Capture the design of the TITLE.FMB form from your working directory using the
following information:

Property Value
Destination Module REN0020
File Name TITLE.FMB
Capture Mode Capture ONLY module design
Create on Diagram after Capture Selected

3 Leave all other inputs as the default and start the utility.
4 Examine the module definition. How many of each were created?

Types of Elements Element Names


Module Components
Table Usages
Item Groups
Bound Items

Windows

5 What is the purpose of an item group (have a look in the online help if you are
unsure)?
6 Delete the item groups from the module. (Forms modules use item groups
differently to Web PL/SQL modules. You look at the use of item groups in a later
lesson.)
7 Set the following properties for the captured module:

Property Value
Module Name RESERVE A TITLE
Language Web PL/SQL
Implementation Name reserve

Note: As an alternative to converting the form module to a Web PL/SQL


module, you could have used the COPY WITH NEW LANGUAGE utility.

.....................................................................................................................................................
4-26 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 4—3: Creating a Web Module from a Captured Form
.....................................................................................................................................................

8 To help the customer select the correct value, set the Show Meaning property to
Meaning only for the TTE_TYPE, GAME_CATEGORY, MEDIUM,
MOVIE_CATEGORY, AGE_RATING, MONOCHROME, and AUDIO bound
items.
9 Generate, install and run the module.
a Press the Find button. Why is there only one Title?
b Why is the Price Code displayed?
Hint: Look at the Generation Message Window.
You will modify this module further in a later lesson.

.....................................................................................................................................................
4-27
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

Hints
Practice 4—1
To perform this task Follow these steps
To open a diagram in 1 Select File—>Open.
the Function 2 Expand the workarea.
Hierarchy
3 Select the diagram.
Diagrammer
4 Click OK.
To create a module in 1 Start the RON.
the RON 2 Expand the required workarea.
3 Select the Modules node in the navigator.
4 Select Edit—>Create.
5 Set the required properties.
To set the language of 1 Select the property palette for the required module.
a module in the RON 2 Click the list icon of the Language property.
3 Select the current workarea from the Look In list.
4 Doubleclick SYSTEM FOLDER.
5 Select the required language from the list.
6 Click OK.
To assign a business 1 Select the module and expand it.
function usage for a 2 Expand the usages.
module 3 Select Implementing Business Functions.
4 Select Edit—>Create Reference.
5 Select one or more functions and click OK.
6 Click Save.
To create default 1 Select the module in the navigator.
module data usages 2 Select Utilities—>Designer—>Create Default Module Data
Usages.
To create links 1 Open the module diagram.
between two base 2 Click the Key Based Link button.
table usages 3 Click on one of the base table usages and drop the link onto the
second usage.

.....................................................................................................................................................
4-28 Oracle Designer 6i: Web PL/SQL Design and Generation
Hints
.....................................................................................................................................................

To perform this task Follow these steps


To create new lookup 1 Click the Create Table Usages button from the Module
table usages Diagram toolbar.
2 Click to the right of the base table usage in the module diagram
(you will see a dashed vertical link).
3 Select the required table from the dialog.
4 Add items and other properties of your choice.
To make an item 1 Select the item.
nondisplayed 2 Navigate to the properties for the item.
3 Set Display? to No.

.....................................................................................................................................................
4-29
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

Practice 4—2
To perform this task Follow these steps
To display records in 1 Select the column on which you wish to order.
a specific order 2 Invoke the properties palette.
3 In the Default Ordering group, set the Order By Sequence.
4 Set the Sort Order to ascending or descending, appropriately.
To create a module 1 Expand the module in the navigator.
component 2 Select the Module Components node.
3 Select Edit—>Create.
To restrict records 1 Open the property dialog for the table usage.
selected in a module 2 Select the Where tab.
component 3 Select the required column and click Add.
4 Complete the condition.
To create parent links 1 Select the module in the navigator or a diagram.
using the Default 2 Select Utilities—>Default Links.
Links utility
3 Select the Find Parents check box.
To create lookup links 1 Select the module in the navigator or a diagram.
using descriptor 2 Select Utilities—>Default Links.
columns
3 Select the Create Table Usages for Descriptor Columns
check box.

Practice 4—3
To perform this task Follow these steps
To capture the design 1 Select Generate—>Capture Design of—>Form.
of a form 2 Specify the name of the destination module.
3 Select the form from the working directory.
4 Click Start.
To delete an item 1 Expand the module in the navigator.
group 2 Expand the Module Components node.
3 Expand the module component.
4 Expand the Item Groups node.
5 Select the required item group.
6 Select Edit—>Delete From Repository....

.....................................................................................................................................................
4-30 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Instructor Notes

Schedule
Timing Topic
44
60 minutes Lesson
D esig ning W eb P L/S Q L M o du les
90 minutes Practice
150 minutes Total

About this Slide


O verview
We have also addressed design capture in this


W h at m u st I d o b efo re bu ildin g a m o d u le?
H o w d o I crea te a m od u le?
lesson. The standard question is “Can I reverse
• W h ich m eth o d sh o u ld I u se to create a m o d u le?
engineer my Web pages?” By the end of the
course the group should be comfortable that
they are generating packages and so any design
capture would result in a series of packages
4-2 and not a module definition. However it is
possible to capture Form modules and generate
them as Web pages, which the students do in
this lesson.
About this Slide
W here D oes It A ll C o m e F ro m ?
Use this slide to recap on First Class. You
could perhaps ask questions here related to
M atrix
F u n ctio n s D iagram m er E n tities each step. Make sure you remind the student
about the Business Function Response
T ab le D efin itio n s
property as they will answer questions about it
M od u les in the first practice.
4-3

About this Slide


U sing C olu m n P ro perties to S et
S tand ard s

R eview co lum n p ro p erties b efo re creatin g m o d ules


C olum n prop erties Item properties
A c tio n Ed it B lo ck F ield

O ther D B + X
A ctio n E dit B lock Field
C opies
+ X
C ustom ers:

D is play type D isplay type


S eq uence D isplay sequen ce
D efault value D efault value
P ro m pt P rom pt
O ptional? O ptional?
... ...
4-4

.....................................................................................................................................................
4-31
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

About this Slide


W here to S et D isplay P ro perties
Spend some time going through the display
C olum n P roperties

D efault D isplay
properties.
D isplay Typ e Text
A lignm ent Left
D isplay Len gth 60
D isplay H eight 3
D isplay S eq uence 20
...

H elp
H int A unique co

4-5

Class Management
H o w to C reate a M od ule
Although we work through these three
A pplicatio n R efine
A utom ated D esign
Transform er
da ta
usag es methods, we also create a module from a
Link C reate
captured form. Remember to mention it here
Link
S em i-
A utom ated
m odules
to
functions
default
data
usage s
data
usages
when discussing the manual method.
D efine D efine
M anual m o dules usa ges
m a nually m an ually

4-6

About this Slide


A p plication D esig n T ransfo rm er
Just recap here by asking questions as the ADT
• U ses: was covered on First Class.
– F un ctio n H ierarch y
– B u sin ess U n its
• P rod u ces:
– M o d u le d efinitio n s
FH D
– M o d u le tab le u sag es

M odule

4-7

About this Slide


L in kin g M o du le C o m po n ents M anu ally

• T ab le u sages m ust
exist
• F o reig n key m u st
exist

• L in k ba se tab le
u sag es
• L in k ba se u sag e to
lo o ku p usag e

4-8

.....................................................................................................................................................
4-32 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

About this Slide


L inkin g M o d ule C om p on ents
A u tom atically Don’t go into any great detail here about
• P arent lin ks
Genera te Default Links
Master-Detail relationships as this topic is
Parent Links
Find Parents
Find Second Parents ORDERS
covered in a later lesson.
Allow Lookup Parents
Allow Keys against M aster Com ponents
Keep Existing Links

Lookup Links
Create Table Usages for Descriptor Colum ns
Use Outer Joins ITEM S
Demo
Find Treew alk Links

OK Canc el Help 1 Point out the inclusion of the primary key


4-9
in the master base table and the foreign key
in the details base table.
2 Invoke the utility using Utilities—>Default
Links.
3 Select Find Parents.
4 Click OK to run the utility.
5 Point out the addition of the link between
the module components.
Demo
L inkin g M o d ule C om p on ents
A u tom atically 1 Point out the inclusion of the foreign key in
• L oo ku p lin ks
Genera te Default Links
the base table.
Parent Links
Find Parents
Find Second Parents
Allow Lookup Parents
2 Ask students which details from the parent
Allow Keys against M aster Com ponents
Keep Existing Links

Lookup Links
table would help to identify the foreign key
Create Table Usages for Descriptor Colum ns
Use Outer Joins
Find Treew alk Links
value.
3 Add these items as descriptors by selecting
OK Canc el Help

4-10

the columns and adding an incrementing


numeric value for each indicating their
display order.
4 Invoke the utility using Utilities—>Default
Links.
5 Select Create Table Usages for
Descriptor Columns.
6 Click OK to run the utility.
7 Point out the addition of the lookup table
and the descriptors.
8 Using the module diagram display view,
resequence the lookup items after the
foreign key.

.....................................................................................................................................................
4-33
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

About this Slide


S em i-A u to m atic M eth o d
• C reate a m o d u le in th e R O N an d ass ociate w ith
o ne or m o re bu sin ess fu nctio n s
The semi-automatic method uses business
function definitions but you control which
ones.
The utility cannot create the module for you so
you must create it. We recommend you create
it in the RON since the utility is only available
4-12
there (it has to see both analysis level and
design level objects). This is the only use of the
RON in this course.
Demo
Show how to create a module and link it to a
business function.
About this Slide
S em i-A u tom atic M eth od
• R u n th e C rea te D efau lt L in ks U tility The utility adds module components and table
usages with bound items. No links are added,
so you must add them either manually or using
the Default Links utility.

Practice
4-13
After discussing this method, it is a good idea
to consolidate the lecture by doing practice
4—1 before moving on to manual creation of
modules.
About this Slide
C reatin g N ew M o du les

U nique and
m andatory

W G _H olly _01 M odule P roperties


A pplication O w ner W S _H O LLY
S hort N am e E M P 0100_W
N am e E m ployees
Lang uage W eb P L/S Q L
P urpo se ...
Im ple m entation N am e EMP

U sed in the U R L

4-16

About this Slide


M od u le an d C o m p o nent P roperties

M odule Langua ge
Type

M o dule C om pon ent Insert, u pdate, and


delete o perations
Q uery
Layout style

4-17

.....................................................................................................................................................
4-34 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Practice
T ab le U sag es
After discussing this method, it is a good idea
• M od u le co m p o n en t tab le u sag es co ntro l:
– D is play W G _H olly _01 M odule P roperties to consolidate the lecture by doing practice
– Ins ert O perations
– U p d ate Insert?
U pdate?
Y es
Y es
4—2 before moving on to design capture.
– Q u ery
D elete? No
Q uery
Q uery? Y es
• L o o ku p tab le u sag es p ro vid e:
– D escrip to r in fo rm atio n
– A d d itio n al valid ation

4-18

About this Slide


U sing E xisting M odu les

• G en erate an exis tin g o r cap tu red:


– F o rm B u ild er m od u le
– R e po rt B u ild er m o d u le
– V isu al B asic m o d u le
. . . as a W ebS erver m o d ule

U se the C opy w ith N ew Lan guage utility

4-20

About this Slide


M ig ratin g a F o rm to th e W eb
B row s er:
A c tio n Ed it B lo ck F ield h ttp ://

C ustom ers:
H o lly w o o d

W eb P L/S Q L
Form
A p plication

• C aptu re th e Fo rm in to th e R ep o sito ry
• C h an g e th e M o d u le L an gu ag e
• R efin e th e m o d u le d efin itio n
• G enerate th e m o d u le

4-21

About this Slide


S um m ary

C rea te W eb P L /S Q L m o du les:
• A u to m a tically u sin g th e A p p licatio n D esig n
T ransfo rm er
• S em i-a u to m atically fro m b u sin ess fu n ctio n s
• M an u ally:
– D e sig n E d ito r
– C o py M o d u le u tility
– C a ptu re D esig n u tility

4-22

Practice 4—3
The captured form contains item
groups which the student is asked
to delete. Make sure all item groups
are deleted as this stops the link to
the view form displaying on the
record list.

.....................................................................................................................................................
4-35
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

.....................................................................................................................................................
4-36 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Post Lesson Teaching Evaluation
.....................................................................................................................................................

Instructor Post Lesson Teaching Evaluation


Name: Full Email:

Course Name: Oracle Designer 6i: Web PL/SQL Design and Generation
Lesson number: 4
Number of teaches before filling this form: 1 - 2 - 3 to 5 - >5

Global comments: (circle all that apply)


• Lesson content: Trivial - Too easy - OK - Difficult - Too difficult
• Slide content: Too many slides - Too few slides - O.K
• Text content.Too much text - Not enough text - Unclear - O.K.
• Practice content: Too difficult - Too easy - Problems - O.K.

Detail comments
Content type: Slide - Text - Practice - Instructor notes
Note: 1:needs animation - 2:too much animation - 3:needs more text - 4:too much text
- 5:Unclear - 6:not necessary - 7:Other

Content Page
Note Comments/Suggestions
Type Number

Photocopy this page and fax to: Oracle Designer Curriculum Development @ +(44) 118.924.5181
Additional sheets are available at the end of the instructor’s guide.
If you draw additional diagrams on the white board use the Graphic sheet in the Instructor Evaluation
section at the end of this book.

.....................................................................................................................................................
4-37
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

.....................................................................................................................................................
4-38 Oracle Designer 6i: Web PL/SQL Design and Generation
Suggested Graphics
.....................................................................................................................................................

Suggested Graphics
Instructor name: Full email:

Course Name:Oracle Designer 6i: Web PL/SQL Design and Generation


Lesson No: 4 Page No:
Please sketch your additional diagram below.

.....................................................................................................................................................
4-39
®
Lesson 4: Designing Web PL/SQL Modules
.....................................................................................................................................................

Oracle Designer Education Products


Curriculum Development
520 Oracle Parkway
Thames Valley Park
Reading - Berkshire
England

fold here

.....................................................................................................................................................
4-40 Oracle Designer 6i: Web PL/SQL Design and Generation
5
.................................

Changing the User


Interface
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Introduction
In this lesson you take a closer look at the output of the Web PL/SQL Generator. The
generator creates a number of different pages, depending on the way the module uses
its base tables. You also learn how to alter the appearance of individual pages, and how
to change the way in which you navigate between the generated pages.

Class
Overview Management
See Page 30

• What pages are generated?


• How can I change the layout of items?
• How can I see more than one form on a page?
• How can I remove duplicate records from the
record list?
• How can I summarize the data on the record list?

5-2

Topic See page


Introduction 2
Review of the Module Structure 4
Module Pages 5
Module Component Pages: Query Form 7
Module Component Pages: Record List 8
Module Component Pages: View Form 10
Module Component Pages: Insert Form 12
Item Layout Styles 13
Module Component Display Styles 14
Removing Duplicate Data from a Record List 17
Summarizing Data on a Record List 19
Summary 21
Practice 5—1: Adding Descriptive Information 22
Practice 5—2: Changing the Item Layout Style 23

.....................................................................................................................................................
5-2 Oracle Designer 6i: Web PL/SQL Design and Generation
Introduction
.....................................................................................................................................................

Topic See page


Practice 5—3: Altering Module Component Display Styles 24
Practice 5—4: Summarizing Data on a Record List 25

Objectives
At the end of this lesson you should be able to do the following:
• Suppress the generation of pages by changing module and module component
properties
• Modify the layout of items in a module component
• Display several generated forms on one HTML page
• Add break groups and summary items to a record list

.....................................................................................................................................................
5-3
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Review of the Module Structure


The Web PL/SQL Generator creates various Web pages for a module. If you alter the
module structure in the Design Editor, you also affect the pages generated.

Class
Module Structure Management
See Page 30

Module Design

About Page Query Generated


Form Record Web pages
Startup Page List View
Form Insert
Form

5-3

The Web PL/SQL Generator always creates the following pages for each module:
• Startup (or first) Page
• About Page
The Web PL/SQL Generator can create the following pages for each module
component, depending on the module component table usages:
• Query Form
• Insert Form
• Record List
• View Form

.....................................................................................................................................................
5-4 Oracle Designer 6i: Web PL/SQL Design and Generation
Module Pages
.....................................................................................................................................................

Module Pages
The Startup Page
The generator creates one startup page for each generated module.

Class
Startup Page Management
See Page 30

• One per module Page header


Title
User text
Link to About page

Module component page


(or link)

Page footer

5-4

The startup page displays:


• The title of the module
• Any module-level user text
• A link to the about page (optional)
• The first module component or a link to it
If the module component has table usages (that is, it is not a menu module), you
can display the first page (usually the query form) on the module startup page.
You can change most of these items through the module property dialog. The Startup
Page category of Generator Preferences enables you to control the items displayed.

Preference Effect
MODALR Controls the display of the link to the about page
MODAPL Sets the wording of the link to the about page
MODFAC Controls alignment of the module content
MODFTF Sets the wording and format of the module title
MODIFZ Controls the display of the first module component on the startup page

.....................................................................................................................................................
5-5
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

The About Page


The generator creates an about page for every module. This page displays information
about the versions of the software used to generate, install, and display the module.

Class
About Page Management
See Page 31

• One per module Page header


• Technical information: Title
• User Technical
• Application Information
system
• Module name
• Database version
• Generator version Page footer
• Preference MODALR

5-5

By default, the generator places a hyperlink to the about page on the startup page for
the module.
You can instruct the generator to suppress the about page hyperlink by setting the
MODALR — Startup Page: About Page hyperlink required
preference. The generator still produces an about page but the user cannot navigate to
it using a hyperlink (you must supply another access mechanism, such as a button).

.....................................................................................................................................................
5-6 Oracle Designer 6i: Web PL/SQL Design and Generation
Module Component Pages: Query Form
.....................................................................................................................................................

Module Component Pages: Query Form


The generator creates one query form for each module component that can be queried.
Demo
Query Form See Page 31
• One per module component Enter query
criteria
Title

User text

Column 1:

Column 2:

Column 3:
Execute
query Column 4:

Find Clear New


Invoke insert
form
5-6

You can change the title and user text through the module component property dialog.
The items displayed on the query form are those base table or lookup table columns in
the module component that have the Query? property set to Yes.

Executing a Query
To execute a query, you enter the query criteria and click on the Find button. This
submits a new URL to the Web server, which queries the database and returns a new
page of HTML that shows the results of the query.

Navigation
You can navigate directly to the insert form from the query form by clicking on the
New button without entering a query.

Suppressing the Query Form


The query form is usually the first page displayed for a module component. If the
module component has the Autoquery? property set to Yes, the first page is the record
list.
If none of the module component’s column usages (base table or lookup table) have
the Query? property set to Yes, the Web PL/SQL Generator does not create any
PL/SQL for a query form. As a result, all queries are unrestricted and the first page is
the insert form.

.....................................................................................................................................................
5-7
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Module Component Pages: Record List


The generator creates a record list for each module component. This page displays all
the records that satisfy a query.
About the Slide
Record List See Page 31
• One per module component Descriptive
Demo
columns
Title See Page 31
User text
Invoke view ZONLRS
form ID Col 2 Col 3 Col 4 Col 5
2001 XXXX XXX XXX XXXX

2002 XXXX XXX XXX


Invoke query
form
First Previous Next ReQuery Count

Query New Invoke Record list


insert form navigation

5-7

Context Items
By default, the record list displays only the primary key column for each record, which
acts as a hyperlink to the view form. To display other, descriptive, columns, you must
set their Context? property to Yes.

Browsing the Record List


From the record list you can browse through the records returned by a query. The
record list displays a fixed number of records. You define the number of records, or set
size, in the preference ZONLRS – Record List: Record Set Size.

Button Description
First Navigates to the first set of records
Last Navigates to the last set of records
Previous Navigates to the previous set of records
Next Navigates to the next set of records
ReQuery Executes the query that originally produced the record list
Count Executes the query that originally produced the record list and
displays the total number of records returned

Each of these buttons appears only when it is appropriate.

.....................................................................................................................................................
5-8 Oracle Designer 6i: Web PL/SQL Design and Generation
Module Component Pages: Record List
.....................................................................................................................................................

Navigation

Viewing the Details for a Single Record Each record on the record list has a
hyperlink. When you click on the hyperlink, the browser submits a new URL to the
Web server, which queries the database for the details of the record and returns the
view form.

Entering a New Query To enter a new query, you can click on the Query button.
This submits a new URL to the Web server, which returns the query form.

Inserting a New Record To insert a new record, you must click on the New button.
This submits a new URL to the Web server, which returns the insert form.

Bypassing the Record List


By default, you navigate from the query form to the record list and then to the view
form. If the query results in only one record, the record list is trivial.
You can omit the record list and navigate directly to the view form if the query results
in only one record. Set the ZONLSR – Record List: Skip record list when
query retrieves one record preference to Yes.

.....................................................................................................................................................
5-9
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Module Component Pages: View Form


The generator creates a view form for each module component. This page lists the
specific details for one record.

Class
View Form Management
See Page 31
• One per module component

Title
Display
User text only

Column 1: XXX
Column 2: XXXXXXXXXX
Column 3: Update
XXXXX
Column 4: XXXXXXX Invoke
Delete
insert
Update record 5:
Column XX form
record

Update Delete Revert New

5-8

The view form shows items with the Display? property set to Yes.
If you can perform update and delete operations on the module component, you do it
through the view form.

Context Items
Items with the Context? property set to Yes appear at the top of the view form. You can
suppress the display of the context items by setting the ZONVCH – View Form:
Display Context Header preference to No Heading or Display Context Values
in Bold.

Updating a Record
If the module component’s Update? property is set to Yes, you can update columns for
which the Update? property is set to Yes. You cannot update columns with only the
Display property set.
You enter new values into the updateable items and click the Update button.
When you click the Update button, you submit a new URL to the Web server, which
tries to update the database with the new values and returns the result of the update
operation in a new HTML page. If the update succeeds, the change is committed
immediately.

.....................................................................................................................................................
5-10 Oracle Designer 6i: Web PL/SQL Design and Generation
Module Component Pages: View Form
.....................................................................................................................................................

You can retrieve the original values by pressing the Revert button. Each item with the
Update? property set has a matching hidden item. When the user presses the Revert
button, the browser applies the values in the hidden item to the displayed items. This
does not roll back an update.

Deleting a Record
If the module component’s Delete? property is set to Yes, you can delete the record by
clicking on the Delete button. You are then asked to confirm the deletion.
The way in which this confirmation is requested differs depending on whether the
browser supports JavaScript:
• If the browser supports JavaScript, you see a generated JavaScript popup. You
click the OK button to confirm the deletion or the Cancel button to cancel the
deletion.
• If the browser does not support JavaScript, you see a generated HTML delete
form. You click the Delete button to confirm the deletion or press the browser’s
Back button to cancel the deletion.
If you confirm the deletion, the browser submits a new URL to the Web server, which
deletes the record and returns a new HTML page with the result of the operation. If the
delete operation succeeds, the change is committed immediately.

Navigation
A hyperlink on the view form enables users to navigate back to the module startup
page, which contains the query form. You can also navigate to the insert form by
clicking the New button.

.....................................................................................................................................................
5-11
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Module Component Pages: Insert Form


The generator creates an insert form for each module component that has the Insert?
property set to Yes.

Class
Insert Form Management
See Page 32
• One per module component

Title Autogenerated
User text columns

Column 1: XXX
Column 2: XXXXXXXXXX
Column 2: XXXXXXXXXX
Column 3: XXXXX
Column 3: XXXXX
Column 5: XX
Column 4: XXXXXXX
Insert
record Column 5: XX

Insert Clear

5-9

Each item displayed on the insert form corresponds to a base table column with the
Insert? property set to Yes.
Mandatory columns must either appear on the insert form or have their values
autogenerated by the Table API.
You enter the new values into the fields and then click the Insert button. This submits
a new URL to the Web server, which inserts the new record into the database and
returns the view form for the new record—including the autogenerated columns.

.....................................................................................................................................................
5-12 Oracle Designer 6i: Web PL/SQL Design and Generation
Item Layout Styles
.....................................................................................................................................................

Item Layout Styles


You can use preferences to change the generated pages.
About the Slide
Item Layout Styles See Page 32

• 54 CARDOSO LUCIA
• Numbered • 55 BAGATINI MARILAN
• Bulleted Bulleted • 56 GREENWALD JOE
• 57 BRANDT STIG
• Table
• 58 BORK LINDA
• Custom
• Free format
54 CARDOSO LUCIA
• Preformatted 55 BAGATINI MARILAN
Table 56 GREENWALD JOE
57 BRANDT STIG
58 BORK LINDA

5-10

For example, you can change the page layout for any of the pages. This is most useful
on the record list. You change the value for the appropriate preference:
• ZONLLS – Record List: Item Layout Style
• ZONQLS – Query Form: Item Layout Style
• ZONVLS – View Form: Item Layout Style
• ZONILS – Insert Form: Item Layout Style
You can choose any of the following styles:

Style Description
Table Lays out the items in a table (You can choose to add a border to it.)
Bulleted Each database record (record list) or item value (query, insert, or view
form) appears on a new line, prefixed with a standard bullet symbol.
Numbered Each database record (on the record list) or item value (on the query, insert,
and view forms) appears on a new line, prefixed with a number.
Custom Each database record (on the record list) or item value (on the query, insert
and view forms) appears on a new line, prefixed with a custom bullet. You
define the bullet character or image in the preference MODCLH – HTML
for custom list item.
Preformatted Item details are displayed in a table format, using a fixed width font such as
Courier.
Free format No formatting takes place and you see information displayed
or Wrap consecutively, wrapping over several lines. This style is most useful for a
page that only displays one record at a time.

.....................................................................................................................................................
5-13
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Module Component Display Styles


You can define the overall appearance of each module component by setting the
display style.
Class
Display Styles Management
See Page 32

Demo
List See Page 32

• Set for each module


component
• Different styles allowed
within one module

List/Form

5-11

Setting the Display Style


In the Edit Module Component Dialog box, click on the Display tab canvas to change
the display style for a module component.
Class
Setting Component Display Style Management
See Page 32

Display
The layout style determines how the module
appears in the generated application

Layout style

List/Form
Form
List

List/Form

5-12

.....................................................................................................................................................
5-14 Oracle Designer 6i: Web PL/SQL Design and Generation
Module Component Display Styles
.....................................................................................................................................................

Using List Style


In List style, the query form, record list, view form, and insert form all appear on
separate pages. Choose this style for module components that have a large amount of
information.
Class
Display Styles—List Management
See Page 33

Each form appears on a separate page


Page header Page header Page header

Title Title Title


Query form Record list View form
XXX: • 01 AAA ZZZ XXX: 01
XXXX: AA% • 02 AAB ZZY XXXX: AAA
XX: Z% XX: ZZZ
• 03 AAC ZYY XXXX: xxxxxxxxx
• 04 AAD ZYX

Page footer Page footer Page footer

5-13

.....................................................................................................................................................
5-15
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Using List/Form Style


In List/Form style, the record list, view form, and insert form all appear within HTML
frames on the same page. The query form remains on a separate page.

Class
Display Styles—List/Form Management
See Page 33
Use Frames preferences

Page header Page header

Title Title
Default text area
Query form
XXX: Record list View form
Insert form
XXXX: AA% • 01 AAA ZZZ XXX: 01
XX: Z% XXXX: AAA
• 02 AAB ZZY
XX: ZZZ
• 03 AAC ZYY XXXX: xxxxxxxxx
• 04 AAD ZYX

Page footer Page footer

5-14

Use this style only if you can effectively display the content of each frame within the
available space. The user’s browser must support HTML frames to be able to use the
module. You can modify other aspects of the list/form presentation style by using the
Frames preferences. By default, the module uses the default frameset; a later lesson
covers customized frame sets.

.....................................................................................................................................................
5-16 Oracle Designer 6i: Web PL/SQL Design and Generation
Removing Duplicate Data from a Record List
.....................................................................................................................................................

Removing Duplicate Data from a Record List


A record list often displays duplicate data; for example, when you include items from
lookup tables as context items.
Class
Standard Record List Management
See Page 33

Bookings
Title Copy Id Book Date
A Man for All Seasons 1016 12-APR-95
Nightmare on Elm Street 1021 27-APR-95
Nightmare on Elm Street 1021 02-APR-98
Nightmare on Elm Street 1022 12-AUG-94
Nightmare on Elm Street 1024 12-JUN-95
Nightmare on Elm Street 1024 10-APR-98
Superman 1017 12-APR-95
Superman 1017 20-JUN-95

Duplicated
data

5-15

Example
You want to see all the BOOKINGS for a particular TITLE but the page shows
duplicated information:
• Each TITLE has a number of COPIES.
• Each COPY can be booked on different dates.
You would like to see each title only once for each group of copies and each copy id
only once for each group of bookings.

.....................................................................................................................................................
5-17
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Splitting Data into Break Groups


You can create break groups to display the data in a more meaningful manner.
About this Slide
Break Report Record List See Page 33

Technical Note
Bookings See Page 33
Title Copy Id Book Date
A Man for All Seasons 1016 12-APR-95 Break
Nightmare on Elm Street 1021 27-APR-95 group
1021 02-APR-98
1022 12-AUG-94Bookings
1024 12-JUN-95
1024 10-APR-98
Superman 1017 12-APR-95 Title
1017 20-JUN-95

Cop Id

Booking Date

5-16

You must create a separate break group for each column on which you wish to break.
The order of the groups and of the items in the groups is significant. You should place
any remaining items in a single break group after the other break groups. The first item
in the last break group is used as the hyperlink.

How to Create a Break Group


1 Sequence the items according to the hierarchical structure of the data.
2 In the Display View of the module diagram, select the items for a group.
3 Click the Create a new Item Group button.
4 In the Edit Item Group dialog, select Is this item a break group?.
5 Click Finish.

Example
To ensure that TITLE appears once for each group of copies and that COPY ID
appears once for each group of bookings, you must place TITLE, CPY_ID and
BOOK_DATE into separate groups. If you only place TITLE in a group, the break
routine only occurs for that item.

.....................................................................................................................................................
5-18 Oracle Designer 6i: Web PL/SQL Design and Generation
Summarizing Data on a Record List
.....................................................................................................................................................

Summarizing Data on a Record List


You can also use break groups to add a summary of the data to a record list.
About this Slide
Record List Summaries See Page 34

Bookings
Title Copy Id Book Date
A Man for All Seasons 1016 12-APR-95
Bookings No of Bookings 1
Nightmare on Elm Street 1021 27-APR-95 Module-level
1021 02-APR-98
component
No of
of Bookings
Bookings 2
Title 1022 12-AUG-94 Grand Total

Total
Cop Id
Superman 1017 12-APR-95
1017 20-JUN-95
No of Bookings 2
Grand
GrandTotal
Total 12
Booking Date
No Bookings

5-17

How to Create a Group Summary Item


A group summary item is useful for summarizing items.
1 In the appropriate break group, create an unbound item with the Unbound Type
property set to Computed.
2 Create the SQL Expression to handle the computation.
3 In the Properties Palette:
a Set the Reset Level property to Current Group or Named Group.
b Set the Reset Group property to the name of the required group.

How to Create a Module-Level Summary


You use a module-level summary item to give a grand total for the module.
1 Create a module component.
2 Set the Module Level? property to Yes.
3 In the module level component, create an unbound item with the Unbound Type
property set to Computed.
4 Create the SQL Expression to handle the computation.
5 In the Unbound Item Properties Palette, set the Reset Level property to Module.

.....................................................................................................................................................
5-19
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Formatting Summary Items


You can set generator Preferences in the Record List category to influence the
summary items you create:
• Set the ZONLPP – Computed item prompt positioning preference to one of
the following values:
– ITEM, to display the prompt in the cell to the left of the computed item
– GROUP, to display the prompt under the last column of the break group.
• Set the ZONLSS – Show computed item separator preference to specify
whether a horizontal line should separate data rows from computed item rows on
the record list.

.....................................................................................................................................................
5-20 Oracle Designer 6i: Web PL/SQL Design and Generation
Summary
.....................................................................................................................................................

Summary

Summary

• Module pages:
– About
– Startup
• Module component pages:
– Query form
– Record list
– View form
– Insert form
• Display styles
• Break groups

5-18

Each module contains a Startup Page, an About Page, and a set of pages for each
module component.
Each module component consists of a set of generated pages including one or more of
the following:
• Query Form
• Record List
• View Form
• Insert Form
You can use generator Preferences to lay out the items in a module component in one
of various styles: Numbered, Bulleted, Table, Custom, Free format, or Pre-formatted.
The module component display style governs the layout of pages:
• List: each form appears on a separate page.
• List/form: the record list, view form, and insert form appear in frames on one
page.
You can modify the record list in order to group similar items and display summaries.

.....................................................................................................................................................
5-21
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Practice 5—1: Adding Descriptive Information


Goal
In this practice you modify the module component to display descriptive columns on
the record list and to reduce the number of pages displayed to the user.

Scenario
You captured the design of module REN0020 - Reserve a Title from a form.
Currently the generated module shows only the values of the primary key and title
columns on the record list and only displays one record at a time. Users who browse
the record list need to see more descriptive information and more records at once.

Your Assignment
Use the following information as your starting point:

Workarea Continue using the same workarea if you


have completed all practices or switch to
rescue workarea ORA<nn>_Les05_stp
Module REN0020 - Reserve a Title

where <nn> is the group number that your instructor has assigned to you.
1 Change the startup page title to Reserve a Title.
2 Suppress the hyperlink to the About page.
3 Modify the TITLES module component and a preference to display 10 records at a
time.
4 Ensure that the following items appear on the record list: PRODUCT_CODE,
TITLE, GAME_CATEGORY, MOVIE_CATEGORY, PRICE.
5 Set a preference to suppress the record list if only one record is returned.
6 Generate, install, and run the module to answer the following questions.
a Execute a query to see the record list. Are there several records in the list?
b Do the correct columns appear as context information?
c Which column in the record list is formatted as a hypertext link?
d Click on the hypertext link for one of the records displayed in the record list.
What information appears at the top of the view form?
e Go back to the query form and enter GR% into the Product Code as the query
criterion. Which form displays after the query form?

.....................................................................................................................................................
5-22 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 5—2: Changing the Item Layout Style
.....................................................................................................................................................

Practice 5—2: Changing the Item Layout Style


Goal
In this practice you modify the layout style of items on a record list.

Scenario
The record list of module REN0020 - Reserve a Title is currently in table
format but some other style may be more helpful to the users. You will test the layout
styles to see which works best.

Your Assignment
Use the following information as your starting point:

Module REN0020 - Reserve a Title

1 Alter the layout style for the record list to bulleted list. Generate, install, and run
the module.
2 Alter the layout style for the record list to numbered list. Generate, install, and run
the module.
3 Decide which is your preferred style and set the layout style appropriately.

.....................................................................................................................................................
5-23
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Practice 5—3: Altering Module Component Display Styles


Goal
In this practice you modify the layout style of a module component.

Scenario
At the moment, the user has to navigate through several pages of module REN0020 -
Reserve a Title to query records and see all the information. It may be a good
idea to reduce the number of pages using the default HTML frames layout.

Your Assignment
Use the following information as your starting point:

Module REN0020 - Reserve a Title

1 Alter the display style of the module component so that the record list and view
form appear on the same page after a query.
2 Generate, install, and run the module.
3 Execute a query:
a What difference do you see?
b When do you think this layout is most suitable?
4 Set the display style to List. Generate, install and run the module.

.....................................................................................................................................................
5-24 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 5—4: Summarizing Data on a Record List
.....................................................................................................................................................

Practice 5—4: Summarizing Data on a Record List


Goal
In this practice you reduce the duplicated records shown on a record list.

Scenario
On the record list of module REN0010 - Review/Book a Video, the same
customer appears several times. You are to reduce this duplication to make it easier for
the user to locate the required information. You also add some summary information to
the record list.

Your Assignment
Use the following information as your starting point:

Module REN0010 - Review/Book a Video

1 Generate, install, and run the module and note the information that is duplicated.
2 Modify the module definition to display the data as a break report, using the
following to assist you:
a Resequence the items to display first those on which you want to break.
Display MBP_IDENTIFIER first, RENTAL_DATE second and RTL_ID third.
b Set the ordering sequence for the data so that it matches the display sequence
of the items.
c Create a break group for MBP_IDENTIFIER and a separate break group for
RENTAL_DATE:

Break Group Columns

MBP_GP MBP_IDENTIFIER
DATE_GP RENTAL_DATE
OTHER_GP All other items

dEnsure the Context? and Display? properties are set to Yes for the items in the
break groups.
e Generate, install, and run the module. What is the impact of creating break
groups?
3 Modify the module definition to include a count of the number of rentals each
customer has made:
a Create a computed unbound item, NO_OF_RENTALS. What properties
should you set? Complete the table below and use it as a guide when setting the
required properties:

.....................................................................................................................................................
5-25
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Property Value
Prompt
Unbound Item Type
Reset Level
Reset Group
Derivation Text

b Place the unbound item in the appropriate item group.


c Generate, install, and run the module. Where do the totals appear in the report?

If you have time


4 Set a preference to remove the lines on either side of the total.

.....................................................................................................................................................
5-26 Oracle Designer 6i: Web PL/SQL Design and Generation
Hints
.....................................................................................................................................................

Hints
Practice 5—1
To perform this task Follow these steps
To change the title for 1 Invoke the Edit Module dialog box.
a module 2 Click on the Titles tab.
3 Enter the title into the Startup Page Title field.
4 Click the Finish button.
To change the title for 1 Invoke the Edit Module Component dialog box.
module component 2 Enter the title into the Title field.
pages 3 Click the Finish button.
To suppress the 1 Select the module component.
About page hyperlink 2 Open the Web PL/SQL Generator Preferences Navigator.
3 Navigate to the Startup Page category.
4 Set the MODALR – Startup Page: About Page
Hyperlink preference to No.
To specify the 1 Open the Web PL/SQL Generator Preferences Navigator for
number of records the module component.
displayed on the 2 Navigate to the Record List category.
record list 3 Set the ZONLRS – Record list: Record Set Size
preference to the required number.
To add context items 1 Invoke the Edit Base Table Usage dialog box.
to the record list 2 Click on the Context tab.
3 Add columns to the Context items box.
To suppress the 1 Open the Web PL/SQL Generator Preferences Navigator for
record list when a the module component.
query returns one row 2 Navigate to the Record List category.
3 Set the ZONLSR – Record list: Skip record list
when query retrieves one record preference to Yes.

Practice 5—2
To perform this task Follow these steps
To alter record list 1 Open the Web PL/SQL Generator Preferences Navigator for
layout style the module component.
2 Navigate to the Record List category.
3 Set the ZONLLS – Record list: Item Layout Style
preference to the required value.
To ensure that you are Use the Refresh or Reload facility of your browser to load the most
running the latest recent version of the current page.
version of a Web page

.....................................................................................................................................................
5-27
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Practice 5—3
To perform this task Follow these steps
To alter the layout 1 Select the module component.
style of a module 2 Invoke the Edit Module Component dialog.
component 3 Click on the Display tab.
4 Change the layout style.

Practice 5—4
To perform this task Follow these steps
To set the sequence of 1 In the Design Navigator, right-click one of the displayed items.
display items 2 Select Resequence Items.
3 Use the arrows to put the items in the correct order.
4 Click OK.
To set the order of the 1 Select the bound item on which you wish to sort.
data 2 Invoke the Edit Bound Item dialog.
3 In the Advanced tab, enter the value for the Order By
Sequence.
To create a break 1 In the Module Diagram, select Display View.
group 2 Select the items for a group.
3 Click the Create a new Item Group button.
4 In the Edit Item Group dialog, select Is this item a
break group?.
5 Click Finish.
To create a computed 1 In the Module Diagram, select Display View.
unbound item 2 Click the Create an Item button.
3 Drag to the correct position and drop the item.
4 Enter the name of the item.
5 Set the Item type property to Computed.
6 Click Next and create the SQL Expression to handle the
computation.
7 Click Finish.
To create a group 1 In the Module Diagram, select Display View.
summary item 2 Create a computed unbound item in the appropriate break
group.
3 In the Unbound Item Properties Palette, set the Reset Level
property to Current Group.

.....................................................................................................................................................
5-28 Oracle Designer 6i: Web PL/SQL Design and Generation
Hints
.....................................................................................................................................................

To perform this task Follow these steps


To create a module- 1 Create a module component and set the Module Level?
level summary item property to Yes.
2 Create a computed unbound item in the module component.
3 In the Unbound Item Properties Palette, set the Reset Level
property to Module.
To create a module- 1 Open the Web PL/SQL Generator Preferences Navigator for
level summary item the module component.
2 Navigate to the Record List category.
3 Set the ZONLSS – Show computed item separator
preference to the required value.

.....................................................................................................................................................
5-29
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Instructor Notes

Schedule

55 Timing Topic
C han g ing the U ser Interface 45 minutes Lesson
45 minutes Practice
90 minutes Total

Class Management
O verview
In this lesson you revisit the module structure


W h at p ag es are ge n erated ?
H o w can I ch ang e th e layo u t o f item s?
and modify the display style of pages.
• H o w can I se e m o re than o n e fo rm o n a p ag e?
• H o w can I rem o ve d up lic ate re co rd s fro m th e Demonstrate as much of the lesson as you can.
re co rd list?
• H o w can I su m m arize th e data o n th e reco rd lis t?

5-2

Class Management
M od u le S tru cture
This is a copy of the slide from Lesson 2, just
M od ule D esign
to remind the students what happens when they
generate.
A bout P age Q ue ry G enerated
Form R ecord W eb pages
S tartu p P age List V iew
Form In sert
Fo rm

5-3

Class Management
S tartu p P ag e
If you haven’t generated the child modules, the
• O n e p e r m o d u le
Title
P age header
hyperlink appears but does not work. The
U ser text
Link to A bou t page
hyperlinks exist because of the module
M odu le com ponent page
(or lin k)
network. That is, in order to get hyperlinks to
P age fo oter
child modules you need to link all the modules
together. This topic is covered in a later lesson.
5-4
See http://invincible.uk.oracle.com/
for white papers.

.....................................................................................................................................................
5-30 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Class Management
A bou t Pag e
Demonstrate the About Page; show them the


O n e p e r m o d u le
T ech n ic al in form atio n : Title
P age h eader
information displayed.
• U s er Technical
• A p plicatio n Inform ation
system
• M o d u le n am e
• D a tab ase version
• G e nerato r versio n P age fo oter
• P refere nce M O D A L R

5-5

Demo
Q uery Fo rm
• O n e p e r m o d u le co m po n en t E nter query
Create a plain module from scratch with a few
criteria
T itle

U ser text
columns and no lookup tables to demonstrate
C olum n 1: each of the pages. Set display, insert, update,
C olum n 2:
and delete properties for the table and columns.
C olum n 3:
E xecu te
query C olum n 4: Point out the components of the query form
Find C lear N ew
Invoke insert
form
and how to use it including the buttons.
5-6

Each action is supported by a specific


procedure invoked by a URL.
About the Slide
R eco rd L ist
• O n e p e r m o d u le co m po n en t D escriptiv e
colum ns
We have called the additional columns
Title
U ser text
descriptive columns and NOT descriptor
In voke view ZO N LR S
fo rm

2001
ID C ol 2
XXXX
C ol 3
XXX
C ol 4
XXX
C ol 5
XXXX
columns. This is because they are not
2002 XXXX XXX XXX necessarily descriptor columns: they are
Invoke q uery
form
First P re vious N ext R eQ uery C ount
additional columns that you have selected to
Q uery N ew Inv oke
ins ert form
R ecord lis t
navigatio n
give additional context information.
5-7

Demo
Point out that some of the buttons only appear
if relevant. That is, the Next button does not
appear unless there is another set of records.
If all the displayed items are context items,
there is no hyperlink to a view form.
Class Management
V iew F orm
• O n e p e r m o d u le co m po n en t If you display all columns as context items
Title
U ser text
D isplay
only
then the record list shows all the items and the
C olu m n 1: XXX view form is only useful for updating and
C olu m n 2: XXXXXXXXXX
C olu m n 3: XXXXX U pd ate deleting records.
C olu m n 4: XXXXXXX Invoke
D elete
insert
U pdate record
C olu m n 5: XX form
record

U pdate D elete R evert N ew

5-8

.....................................................................................................................................................
5-31
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Class Management
In sert F orm
• O n e p e r m o d u le co m po n en t As you build the slide, point out that the
Title
U ser text
A utogenerated
colum ns autogenerated columns do not appear until you
C olum n 1: XXX
C olu m n 2: X X X X X X X X X X
have inserted the record.
C olum n 2: XXXXXXXXXX
C olu m n 3: X X X X X
C olum n 3: XXXXX
C olum n 5: X X
C olum n 4: XXXXXXX
Insert
record C olum n 5: XX

Inse rt C lear

5-9

About the Slide


Item L ayo ut S tyles
This slide shows two of the layouts available.
• 54 C A R D O SO L U C IA


N u m b ered
B u llete d B ulleted


55
56
B A G A T IN I
GREENW ALD
M A R IL A N
JO E
The notes describe the others.
• 57 BRANDT ST IG
• T ab le
• 58 BORK L IN D A
• C u sto m
• F ree fo rm at
54 C A R D O SO L U C IA
• P refo rm atted 55 B A G A T IN I M A R IL A N
T able 56 G R E E N W A L D JO E
57 B R A N D T ST IG
58 B O R K L IN D A

5-10

Class Management
D isplay Styles
If the layout style is set to NULL, the style
List defaults to list.
• S et fo r ea ch m o d u le
com p o ne n t
• D ifferen t styles allo w ed Demo
w ith in o n e m od ule

You can demonstrate this section. Change a


List/Form style and generate. You can flip back to the
5-11
slides while the module generates. Once it
completes invoke your browser and
demonstrate the results. You can continue to do
this, changing the styles and generating. If you
have your browser running, refresh the screen
to get the latest Web page.
Class Management
Setting C o m po n ent D isp lay S tyle
The build shows how you would change the
D isplay
The layou t style determ ines ho w the m odule
style. You may want to demonstrate this
appears in the genera te d application
instead of using the slide.
Layout style

List/Form
Form
List

List/Form

5-12

.....................................................................................................................................................
5-32 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Class Management
D isplay Styles— List
This slide builds the way you would navigate
E ach form a ppears on a separate page
P age header P age header P age header
across the Web pages.
Title Title T itle
Q uery form R ecord lis t V iew form
XXX: • 01 AAA ZZZ XXX: 01
XXXX: AA% • 02 AAB ZZY XXXX: AAA
XX: Z% XX: ZZZ
• 03 AAC ZY Y XXXX: xxxxx xxxx
• 04 AAD ZY X

P age fo oter P age footer P age footer

5-13

Class Management
D isp lay S tyles— L ist/F o rm

U se Fram e s prefe rences


The build shows the default way that the pages
P age header P age header display when you navigate from the query
Title
Title

Q uery form
D efault text area page to the Record List.
XXX: R ecord lis t V iew form
Insert fo rm
XXXX: AA%
XX: Z%
• 01
• 02
AAA
AAB
ZZZ
ZZY
XXX:
XXXX:
01
AAA
A later lesson talks about modifying the
XX: ZZZ
• 03
• 04
AAC
AAD
ZY Y
ZY X
XXXX: xxxxxx xxx
frames.
P age fo oter P age foo ter

5-14

Class Management
S tand ard R ecord List

The problem A record list displays


B oo kin g s
Title
A M an for A ll S eason s
C opy Id
1016
B ook D ate
12-A P R -95
duplicate data.
N ightm are on E lm S tre et 1021 27-A P R -95
N ightm are on E lm S tre et 1021 02-A P R -98
N ightm are on E lm S tre et 1022 12-A U G -94
N ightm are on E lm S tre et
N ightm are on E lm S tre et
S uperm an
1024
1024
1017
12-JU N -95
10-A P R -98
12-A P R -95
The solution Create break groups.
S uperm an 1017 20-JU N -95

D uplicated
data

5-15

About the Slide


B reak R epo rt R eco rd L ist
Booking date is not in a break group. The
B o o kin g s generator has therefore included it into the
Title C o py Id B oo k D ate
A M an for A ll S ea sons
N ig htm are on E lm S treet
1016
1021
1021
12-A P R -95
27-A P R -95
02-A P R -98
B reak
group Copy Id break group and Copy Id is the
1022
1024
1024
12-A U G -94B ookings
12-JU N -95
10-A P R -98
hyperlink. It would probably be better if
S u perm an 1017 12-A P R -95 Title
1017 20-JU N -95 Booking Date were the link. This could be
C o p Id
achieved by creating another group
B o oking D ate

5-16

Technical Note
If some items are not in a break group, the
generator moves them into the last break group
it finds. This may result in the breaks
appearing in the wrong place.

.....................................................................................................................................................
5-33
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

About the Slide


R ecord List S um m aries
The build shows the group summary item first
B o o kin g s
T itle
A M an for A ll S ea sons 1016
C op y Id B ook D ate
12-A P R -95
and then the module summary item.
B ookings N o of B ooking s 1
N ig htm are on E lm S treet 1021 27-A P R -95 M odule-lev el
1021 02-A P R -98
com ponen t
N o of
of BBooking
ookingss 22
Title 1022 12-A U G -94 G rand Total

T otal
C oan
S up erm p Id 1017 12-A P R -95
1017 20-JU N -95
N o of B ooking s 2
G
Grand
rand Total
Total 12
B o oking D ate
N o B ookings

5-17

Class Management
S um m ary

• M o d ule pag e s:
– A b ou t
– S tartup
• M o d ule com p o nen t p ag es:
– Q u ery fo rm
– R e cord list
– V iew form
– In sert fo rm
• D isplay style s
• B reak g ro u p s

5-18

.....................................................................................................................................................
5-34 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Post Lesson Teaching Evaluation
.....................................................................................................................................................

Instructor Post Lesson Teaching Evaluation


Name: Full Email:

Course Name: Oracle Designer 6i: Web PL/SQL Design and Generation
Lesson number: 5
Number of teaches before filling this form: 1 - 2 - 3 to 5 - >5

Global comments: (circle all that apply)


• Lesson content: Trivial - Too easy - OK - Difficult - Too difficult
• Slide content: Too many slides - Too few slides - O.K
• Text content.Too much text - Not enough text - Unclear - O.K.
• Practice content: Too difficult - Too easy - Problems - O.K.

Detail comments
Content type: Slide - Text - Practice - Instructor notes
Note: 1:needs animation - 2:too much animation - 3:needs more text - 4:too much text
- 5:Unclear - 6:not necessary - 7:Other

Content Page
Note Comments/Suggestions
Type Number

Photocopy this page and fax to: Oracle Designer Curriculum Development @ +(44) 118.924.5181
Additional sheets are available at the end of the instructor’s guide.
If you draw additional diagrams on the white board use the Graphic sheet in the Instructor Evaluation
section at the end of this book.

.....................................................................................................................................................
5-35
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

.....................................................................................................................................................
5-36 Oracle Designer 6i: Web PL/SQL Design and Generation
Suggested Graphics
.....................................................................................................................................................

Suggested Graphics
Instructor name: Full email:

Course Name:Oracle Designer 6i: Web PL/SQL Design and Generation


Lesson No: 5 Page No:
Please sketch your additional diagram below.

.....................................................................................................................................................
5-37
®
Lesson 5: Changing the User Interface
.....................................................................................................................................................

Oracle Designer Education Products


Curriculum Development
520 Oracle Parkway
Thames Valley Park
Reading - Berkshire
England

fold here

.....................................................................................................................................................
5-38 Oracle Designer 6i: Web PL/SQL Design and Generation
6
.................................

Implementing User
Interface Standards
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Introduction
You can enhance your Web PL/SQL modules by defining user text against modules
and module components. You can also standardize the look of the pages by applying
style templates and defining custom framesets.
Class
Overview Management
See Page 40

• Can I add text to modules?


• How do I format text?
• How do I format columns?
• How do I add a standard header and footer to my
application?
• How do I make all my pages look the same?
• How do I see more than one page at a time?

6-2

Topic See Page


Introduction 2
Adding User Text 4
Using HTML in User Text 7
Using the Toolkit in User Text 9
Using Custom Functions in User Text 10
Accessing Images 11
Formatting Column Values 12
Adding Standard Headers and Footers to Applications 14
Setting the Default Colors 15
Creating a Document Template 16
Mapping Document Templates to Generated Pages 19
Creating a Frameset 20
Invoking a Custom Frameset 24
Summary 26
Practice 6—1: Adding Static Text and Images 28
Practice 6—2: Adding Standard Headers and Footers 30

.....................................................................................................................................................
6-2 Oracle Designer 6i: Web PL/SQL Design and Generation
Introduction
.....................................................................................................................................................

Topic See Page


Practice 6—3: Formatting Column Values 32
Practice 6—4: Using a Style Sheet 33
Practice 6—5: Creating a Custom Frameset 35

Objectives
At the end of this lesson, you should be able to do the following:
• Apply user text to a module and a module component
• Format user text with HTML and calls to functions
• Format column data
• Add standard headers and footers to pages
• Create and use document templates or style sheets to control the appearance of
generated and static pages
• Create and use custom framesets to enhance module layout and functionality

.....................................................................................................................................................
6-3
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Adding User Text


You can add instructions and information to your modules.
Demo
Types of User Text See Page 40

Image
Static
Text
Welcome!!

URL
URL
• Film Reviews
• Disney

Mailto
Do you have any questions? Email
Hollywood Video

6-3

You can include plain text, images, links to email addresses and Web pages as user
text. You can format user text with HTML or calls to code from the PL/SQL Toolkit,
the WSGL packages, and other packages that you create.

Universal Generation and User Text


You can use a single module definition in the repository to generate modules in
multiple languages. For example, you may generate a form, a report, and a Web page
from the same definition. However, the Developer’s Toolkit in user text is specific to
the Web PL/SQL Generator. When you generate a Form module, the user text becomes
Help Text. If the user text contains calls to HTF functions, they appear as literal text.

.....................................................................................................................................................
6-4 Oracle Designer 6i: Web PL/SQL Design and Generation
Adding User Text
.....................................................................................................................................................

Specifying User Text


You enter user text for a module or module component into the appropriate user text
property in the Design Editor.
Class
Defining User Text Management
Define in the Design Editor . . .
See Page 40

User Text Demo


See Page 40
User text can be displayed...

Default Area HTP.BOLD(‘Web Page Text’)


Top of Record List <ul><li>Bullets </li>
</ul> …

Web Page Text


• Bullets
• Images
. . . generate into a
Web PL/SQL module
6-4

The easiest way to view and edit user text is to use the property dialog boxes, which
show the user text separately for each location.
In the repository, user text is stored with tags to indicate the different locations.
In the Property palette, all the user text appears in a single field, as shown in the
following extract:

Default text

CG$VF_TP
Use this page to enter details for....

CG$QF_TP
htf.tableOpen...

CG$IF_TP
Use this page to enter details for...

.....................................................................................................................................................
6-5
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Location of User Text


You can include static text on any of the Web pages that the generator creates.

Class
Controlling the Location of User Text Management
See Page 41
Default
Area

Top of
Record List
Bottom of
Record List

6-5

You can include user text at the module level, in the default area or at the top and
bottom of the first page. The “first page” is defined as everything before the first
module component. If the first module component page (for example, the query form)
is displayed on the startup page, then the user text for the bottom of the first page is
displayed just before the module component title.
You can specify user text for each module component, at the top and bottom of each of
the module component pages.

User Text on the Delete Form


When users press the Delete button on the view form, they see a generated HTML
delete form if their browser does not support JavaScript. The delete form can include
user text in the same way as other module component pages.
If their browser does support JavaScript, they see a generated JavaScript popup that
does not use the user text.

.....................................................................................................................................................
6-6 Oracle Designer 6i: Web PL/SQL Design and Generation
Using HTML in User Text
.....................................................................................................................................................

Using HTML in User Text


HyperText Markup Language (HTML) is used to write pages for the Web.
About this Slide
HyperText Markup Language See Page 41

• Processed by Web browsers


• Tells a browser how to paint the screen
• Uses tags to define:
– Headings <H1> </H1>
– Images <IMG SRC=“img.gif”>
– URLs

Send email to
Holly@video.com
Visit our Web site
Hollywood Video

6-6

Web browsers use HTML instructions (tags) to paint the screen. You can format user
text by embedding HTML tags in it.
The following table lists some common HTML tags.

HTML tags Description


<B>...</B> Display text between the tags in bold
<I>...</I> Display text between the tags in italic
<BR> Break line
<H2>...</H2> Display text between the tags as a level 2
heading
<IMG SRC=”/images/name.gif”> Display the named image file

You can embed any of the features of HTML directly in user text.

.....................................................................................................................................................
6-7
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Class
Embedding HTML Management
You can embed <b>HTML</b> into See Page 41
your:
User Text <ul><li>Module User Text. </li>
<li>Page User Text.</li>
</ul>

MODSUB=Y MODSUB=N
(default)

You can embed <b>HTML</b> You can embed HTML into your:
Youyour:
into can embed <b>HTML</b> You can
• Module embed
User Text.HTML into
your:
into your:
<ul><li>Module User Text.</li> • Page User Text.
<ul><li>Module User Text.</li> • Module User Text.
<li>Page User Text.</li></ul>
<li>Page User Text.</li></ul> • Page User Text.

6-7

By default, the generator creates PL/SQL that prevents the browser from interpreting
the HTML; instead it displays the HTML to the screen.
If you use HTML in the user text areas, you should set the MODSUB - Substitute
HTML reserved characters text handling Generator Preference to No. This
ensures that the browser interprets the HTML and does not write it directly to the
screen.

.....................................................................................................................................................
6-8 Oracle Designer 6i: Web PL/SQL Design and Generation
Using the Toolkit in User Text
.....................................................................................................................................................

Using the Toolkit in User Text


The Toolkit contains two packages that you are likely to use when you are writing Web
PL/SQL applications: HTP and HTF. Most procedures in the HTP package exist as
functions in the HTF package.
Class
Using the Toolkit Procedures Management
See Page 41
If you need help, contact
User Text <I>htf.mailto(’cs@hollywood.com’,
‘Customer Services’)</I>

htp.p(‘If you need help, contact <I>’||


htf.mailto(’cs@hollywood.com’,
PL/SQL ‘Customer Services’)||
’</I>’);

Web Page If you need help,


contact Customer Services

6-9

You can write calls to HTF functions in the user text area, intermingled with text and
HTML. In the generated code, all user text is enclosed in a call to HTP.P.
• HTF functions return formatted HTML to the HTP.P procedure
• HTP procedures send HTML text to the calling program
The HTP.P procedure (also defined as HTP.PRINT) takes a single text argument and
outputs it unchanged to the client. This is useful for printing text that you do not wish
to format. You can nest functions within other functions. In a function call, you can
also concatenate items.

.....................................................................................................................................................
6-9
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Using Custom Functions in User Text


You may find that HTML and the functions in the HTF package do not produce the
result that you require. You can write database functions that you reference from
within the user text.

Class
Using Custom Functions Management
See Page 41

1. Write a function that returns HTML.


2. Place the function in a package.
3. Set the PKGLST preference.
4. Use the function in user text.

HTF.HR This is some text.


my_html.cust(‘This text is a parameter
to the function.’)

6-10

To use custom functions, carry out the following:


1 Write PL/SQL functions to achieve the results that you want.
2 Encapsulate the functions within a PL/SQL package.
3 Put the name of your package in the PKGLST - PL/SQL Package List Text
Handling preference.
If you do not add the package to the PKGLST preference, the generator treats the
function calls as text, which it prints out directly to the user’s screen. You can
include many custom packages in your user text. Separate each package in the
PKGLST preference with a comma (,).
4 Refer to the package in user text, just as you do with the HTF functions.
You should copy the module definition for each generator, instead of using multiple
generators on the same module. You can then modify each module according to the
peculiarities of the specific generator.

.....................................................................................................................................................
6-10 Oracle Designer 6i: Web PL/SQL Design and Generation
Accessing Images
.....................................................................................................................................................

Accessing Images
The Web server administrator can map virtual directories to physical directories. A
browser accesses the information on your server through the virtual directories.
Class
Virtual Directories Management
See Page 42
holly

webapp

images docs

Virtual Directory Physical Directory


/graphics /holly/webapp/images

6-11

Mapping Virtual Directories


If you store your Web images (.jpg and .gif files) in a physical directory called
/holly/
/images, it is cumbersome to specify this address each time you refer to an image.
The Web server administrator maps a virtual directory to the physical directory. When
a client requests the file /graphics/logo.gif, the server returns the file
/holly/webapp/images/logo.gif.

Including Images in User Text


If you need to reference an image file in user text, you can use an HTML tag or a call
to an HTF function. The reference should include the full virtual directory path.
<IMG SRC=’/graphics/logo.gif’>
HTF.IMG(’/graphics/logo.gif’)

Adding a Background Image


The MODBGR - Background Image File preference (in the Document
Attributes category) specifies the full virtual directory path and name of a file that is
displayed as the background to your Web PL/SQL pages. You can set this preference
at application or module level but it is ignored if you apply a document template.

.....................................................................................................................................................
6-11
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Formatting Column Values


Some columns may contain data that you want to format as bold or italic. Others may
contain special types of information, such as an email address, the URL for a Web site,
or the name of an image file on the server.

Formatting Columns

Employees
101, Niall John
Email
Emp Id: 101 formatting
Last Name: John
First Name: Niall
Email: njohn@hollywood.com Bold
Position: Manager formatting
Photo:

Image
formatting

6-12

If you do not take any action, the column data (for example, the name of the image
file) is displayed on the screen. You use the Formatting display property of the bound
item to instruct the generator to place appropriate format tags around the column data.
The generator converts the column formatting property into an appropriate call to the
WSGL procedures.
By default, column formatting is applied to the record list and to columns on the view
form that cannot be updated. You can suppress column formatting on the record list by
setting the ZONLHF – Record List: Apply HTML Formatting preference to No.

Displaying a URL
If you select a formatting type of URL, the generated code includes a call to
WSGL.ANCHOR2. The browser displays the caption of the column as a hyperlink. When
the user clicks on the caption, the Web browser submits the URL to the specified
server. The column should contain either a complete URL (starting with http://) or a
URL relative to the domain in which the application is running.

Displaying an Image
If you select a formatting type of IMAGE, the column data type must be VARCHAR2
and contain the filename of the image. The generated code includes a call to
WSGL.IMG. The browser automatically requests the image file from the server.

.....................................................................................................................................................
6-12 Oracle Designer 6i: Web PL/SQL Design and Generation
Formatting Column Values
.....................................................................................................................................................

Adding Graphic Hotspots to the Record List


Demo
Graphical Record List See Page 42

6-13

You can display the record list as a series of graphic hotspots that link to view forms.
1 In the Edit Bound Items dialog for the item:
a Select IMAGE from the Formatting dropdown list.
b Set the Context? property.
2 Set the record list preferences:
• ZONLRS – Record List: Record Set Size defines the number of records
displayed at once.
• ZONLTC – Record List: Number of Records per Line defines the
number of records displayed on each line.
3 Define the default virtual directory for the image files in the IMGIFP – Default
image location preference. (This means that the column need only contain the
file name or a directory path relative to this directory.)

.....................................................................................................................................................
6-13
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Adding Standard Headers and Footers to Applications


You can add text or graphics to the top and bottom of generated Web pages
by setting preferences for the application or the module.
About the Slide
Headers and Footers See Page 42
Generator Preferences
Set footer on
Product
all pages

MODSFA Yes
MODSFT myHTML.myFooter
MODSHA No
MODSHD HTF.BOLD(‘text’)

Set header on
Startup page only

6-14

As with user text, you can format headers and footers using HTML and calls to
PL/SQL functions (either in the HTF package or a custom package).

Preference Preference Name Description


MODSHD Standard Header Defines the content of the page header
MODSHA Standard header on Set to Yes to ensure the header appears on all the
all pages pages generated for a particular module or No
for it to appear on only the Startup Page
MODSFT Standard footer Defines the content of the page footer
MODSFA Standard footer on Set to Yes to ensure the footer appears on all the
all pages pages generated for a particular module or No
for it to appear on only the Startup Page

The header or footer must explicitly include all the features that you require. For
example, if you want to display a line underneath the header, you must include
htf.line or <hr> in the standard header text.
If you set preferences at the container level, all the pages in the application have the
same header and footer. If you set preferences at the module level, you can define
different headers and footers to clarify different areas of functionality.

.....................................................................................................................................................
6-14 Oracle Designer 6i: Web PL/SQL Design and Generation
Setting the Default Colors
.....................................................................................................................................................

Setting the Default Colors


By default, the Web PL/SQL Generator uses a set of standard, built-in styles to set the
colors used in a generated application.
Demo
Document Attributes See Page 42
Reserve a Title MODFGC
text color
Use these pages to enter
booking details:
MODVLC MODBGC
visited link BOOKINGS background
• About color
Enter query criteria
for BOOKINGS: MODSLC
MODALC standard link
Booking No:
active link
Title: LOV
• Return

FF0000 : red
Set colors as hexadecimal 0000FF : blue
value (RRGGBB) 00FF00 : green

6-15

You can control the background color, background image, text color, and hyperlink
color by setting the Document Attribute preferences.

Preference Preference Name Description


MODALC Active Hyperlink Defines the color of hyperlinks when you select
Color or click them
MODBGC Background Color Defines the color of the page background
MODFGC Text Color Defines the color of normal text on the page
MODSLC Standard Hyperlink Defines the color of hyperlinks not yet clicked
Color
MODVLC Visited Hyperlink Defines the color of clicked hyperlinks
Color

You define colors using hexadecimal RGB values. The Designer 6i help system
contains a color chart to help you decide on colors.
You can set Document Attribute preferences at application or module level but they
are ignored if you apply a document template. If you set them at the module level, you
can differentiate specific areas of functionality. If you set them at the container level,
your Web PL/SQL application uses a common color scheme across all pages.

.....................................................................................................................................................
6-15
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Creating a Document Template


If the default styles used by the Web PL/SQL Generator do not fit your requirements,
you can apply document templates to your modules. This is a good way to ensure that
standards are applied consistently across your application.

About the slide


Document Templates See Page 43
Reserve a Title
Use these pages to enter
QUERY FORM
QUERY FORM
booking details: 4GUGTXGC6KVNG
Default
Default Template
Template
BOOKINGS 8VHWKHVHSDJHVWRHQWHU
ERRNLQJGHWDLOV:
• About
Enter query criteria for $11-+0)5
BOOKINGS:
• About
Booking No: Enter query criteria for
Title: BOOKINGS:

Booking No:
Title: LOV
Apply template

6-16

A document template is a text file that contains HTML style information. During
generation, the Web PL/SQL Generator reads the document template file and
incorporates the HEAD section (any tags defined between the <HEAD> and
</HEAD> tags) into the generated document. The browser does not need access to the
template when the application is running.

.....................................................................................................................................................
6-16 Oracle Designer 6i: Web PL/SQL Design and Generation
Creating a Document Template
.....................................................................................................................................................

Building a Document Template


A document template is a text file that contains HTML tags. You can create it in an
HTML editor or a text editor.

About the slide


Creating a Template File See Page 43

• Use text editor


• Set parameters for each HTML element
<HTML>
<HEAD>
<STYLE>
BODY {font:12pt Arial; background: yellow;
color: red}
H1 {font: 18pt Arial; font-weight: bold; color: blue}
P {font: 10pt Arial; font-weight: bold; color: red}
</STYLE>
</HEAD>
</HTML>
6-18

The most important tags in terms of your generated HTML pages are the following:
• <BODY> defines the style for user text.
• <H1> defines the style for page titles.
• <P> defines the style for captions on the query form, record list, view form, and
insert form.
• <TABLE> defines the style for the returned data.
Note: Some HTML elements inherit properties from their parent element. You can set
the inheritance explicitly within a style sheet. If you define the settings for the
<BODY> tag as follows:
BODY {font: Arial; size: 10pt; font-style: italic;
font-weight: bold; color:red}
then <H1> inherits the font, style, weight, and color from <BODY> unless you
explicitly define it differently.

.....................................................................................................................................................
6-17
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Using Cascading Style Sheets

Class
Using a Cascading Style Sheet Management
See Page 43

Document template

<link rel=stylesheet type="text/css" href="mystyles.css">

Cascading style sheet

<STYLE>
BODY {font:12pt Arial; background: yellow;
color: red}
H1 {font: 18pt Arial; font-weight: bold; color: blue}

P {font: 10pt Arial; font-weight: bold; color: red}


</STYLE>

6-19

A cascading style sheet is a standard Web file that defines the style of an HTML page.
Unlike the document template, it is read by the browser at runtime.
If you define the page style in a document template, you must regenerate the module if
you change the template. However, a document template may refer to a cascading
style sheet. If you change the cascading style sheet, you do not have to regenerate the
module: any changes are picked up the next time you run the module. However, the
reference to the style sheet must include the virtual directory path, as the browser must
be able to access it at runtime.
If you use a cascading style sheet, your document template merely needs to reference
the style sheet:
<link rel=stylesheet type="text/css" href="/docs/mystyles.css">
<meta http-equiv="charset" content="iso-8859-1">
For more information on cascading style sheets, see the following Web sites:
• The W3 Consortium at http://www.w3.org/Style
• The Web Design Group at http://www.htmlhelp.com/reference/css

Technical Note
Not all browsers support cascading style sheets.

.....................................................................................................................................................
6-18 Oracle Designer 6i: Web PL/SQL Design and Generation
Mapping Document Templates to Generated Pages
.....................................................................................................................................................

Mapping Document Templates to Generated Pages


You use preferences to map document templates to pages in your modules.
Class
Applying Templates Management
See Page 44
Demo
Generator Preferences
See Page 44
Product

Insert Form
Document Templates

Query Form DOCTIF iftemp.txt


DOCTLV lvtemp.txt

Record List DOCTQF qftemp.txt


DOCTRL rltemp.txt
View Form DOCTVF vftemp.txt

6-20

In the preferences, you must specify the full path and file name of the templates,
relative to your Designer 6i working directory (they are only required during
generation).
• DOCTAP – About Page Template Filename
• DOCTIF – Insert Form Template Filename
• DOCTLV – List of Values Template Filename
• DOCTMC – Module Content Template Filename
The module content template is applied to the startup page.
• DOCTQF – Query Form Template Filename
• DOCTRL – Record List Template Filename
• DOCTTF – Text Frame Template Filename
This template is applied to frames that do not contain dynamic data (for
example, the frame that contains the page header).
• DOCTVF – View Form Template Filename
If you apply a single template to every type of generated document, you create an
module that presents a consistent look and feel across all its pages. Alternatively, you
can apply different templates to individual document types.
Note: If you define Document Template preferences, any values for Document
Attributes preferences are ignored for those generated pages.

.....................................................................................................................................................
6-19
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Creating a Frameset
You can use HTML frames to divide a Web page into separate regions that display
content independently. The Web PL/SQL Generator includes a default frameset that
you can refine to suit your needs. You can also define custom framesets.
If you define the Layout Style for a module component as List/Form, the Web PL/SQL
Generator uses framesets to display more than one generated page on the same page.

Modifying the Default Frameset


About the slide
Default Frameset See Page 44

Browser:
http://www....

View
UPPER form

LEFT RIGHT

Insert
Record form
LOWER
list

Use preferences to alter proportions


(FRAMES - Default)

6-21

The Web PL/SQL Generator uses the default frameset to display the record list, view
form, and insert form on the same page. (The query form remains on a separate page.)
• The top frame displays the page header, title, default text area and return links.
• The left frame displays the record list.
• The right frame displays the view form and the insert form.
• The bottom frame displays the page footer, if there is one.
To ensure that the page presents information in the most economical way, you can
predefine the size of each frame using Frames - Default preferences.
• LFCOLS – Column Widths defines the relative widths of the central two frames.
• LFROWS – Row Heights defines the relative heights of the top frame and the
record list/view form frames.
• MODSFH – Standard Footer Frame Height defines the absolute height of the
bottom frame (if a standard page footer is defined).
• LOVFWD – LOV Frame Width defines the absolute width of the LOV frame (if the
LOV style preference is set to Frames).

.....................................................................................................................................................
6-20 Oracle Designer 6i: Web PL/SQL Design and Generation
Creating a Frameset
.....................................................................................................................................................

Defining Frame Sizes

Class
Defining Frame Sizes Management
See Page 44
Percentage Relative Absolute
LFROWS: 25%, 75% LFROWS: *, 3* LFROWS: 100, *

Top

Record list View form

6-22

You define the sizes of your frames using the formats of the <FrameSET> HTML
tag:
• Percentage of the available space
• Relative quantities of the available space
• Absolute size in pixels

Example

Value of Effect
LFROWS
preference
15%,85% The top frame takes up 15% of the space above the footer frame and the
record list/view form/insert form frame takes up 85% of the space.
*, 3* The top frame takes up a quarter of the space and the record list/view form/
insert form frame takes up three-quarters of the space. The browser calculates
that the size of the first frame is one-third that of the second.
100, * The top frame is 100 pixels high and the record list/view form/insert form
frame occupies the rest of the space.

.....................................................................................................................................................
6-21
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Defining a Custom Frameset


You can define a custom frameset for a module component. A custom frameset is
defined by a template, which is a text file that contains HTML frame tags. You can
create it in an HTML editor or a text editor.
About the slide
Building a Frameset See Page 44

<HTML>
<FRAMESET ROWS="30%, 50%, 20%">
First row
<FRAME NAME="UPPER"> (30%)
<FRAMESET COLS="30%, *">
<FRAME NAME="LEFT"> Second
<FRAME NAME="RIGHT"> row (50%)
</FRAMESET>
<FRAME NAME="LOWER" Third row
(20%)
SRC="c:\footer.txt">

</FRAMESET>
</HTML>

6-23

The frameset template names the frames and specifies their sizes. You use preferences
to specify that the generator uses a custom frameset and also to map the names of the
frames to the generated pages.
Class
Displaying a Frameset Management
See Page 45

UPPER
30% rows

LEFT RIGHT
50% rows 50% rows
30% cols * cols (70%)

LOWER
20% rows

6-24

.....................................................................................................................................................
6-22 Oracle Designer 6i: Web PL/SQL Design and Generation
Creating a Frameset
.....................................................................................................................................................

Naming Frames
Each frame must have a name. The names are case-sensitive. If you create a frameset
with rows called LEFT and RIGHT, the generator ignores a preference that maps a
page to a frame called Left.

Nesting Framesets
In order to divide the screen into rows and columns you must nest framesets. A nested
frameset informs the browser how to subdivide the current frame. In the code below,
the screen is divided into two rows; the second row takes up 60% of the screen and is
divided into two equal columns:
<frameset rows=”40%, 60%”>
<frame name=”upper”>
<frameset cols=”50%, 50%”>
<frame name=”left”>
<frame name=”right”>
</frameset>
</frameset>

Loading a Frame with Non-Generated Data


If you specify a SRC attribute for the <Frame> tag, the specified file is loaded into that
frame.
<Frame NAME=”left” SRC=”/graphics/footer.img”>
If you map a generated page to this frame, the generator replaces the SRC attribute
with the generated page.

.....................................................................................................................................................
6-23
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Invoking a Custom Frameset


You use preferences to map the pages for a module component to the frames named in
the custom frameset.
If the display layout for the module component is set to List/Form, you must set two
preferences to ensure that the custom frameset is used:
• LFCUST – Use Custom Frameset must be set to Yes.
• LFFSTP – Template Filename defines the full path and file name of the
frameset template. The template file is only used during the generation process.
The module does not require the template when you run the application.
Class
Mapping Pages to Frame Locations Management
See Page 45
Generator Preferences Demo
Product
See Page 45
Default text
Frames - Custom

Template LFDTFM UPPER


LFFSTP frame.htm
Record list LFQFFM LEFT
LFRLFM LEFT
View form LFVFFM RIGHT

6-25

You set the following Frames - Custom preferences to map pages to frames:
• LFMCFM - Module Content Frame defines the frame for the module
content; if this preference is blank, the module content is placed in the first frame.
• LFDTFM - Default Text Frame defines the frame in which the default
text appears; if this preference is blank, the default text appears in the same frame
as the record list.
• LFRLFM - Record List Frame defines the frame in which the record list
appears; if this preference is blank, the record list appears in the first frame.
• LFQFFM - Query Form Frame defines the frame in which the query form
appears (when it does not appear on a separate page, that is, LFQOSP is No); if this
preference is blank, the query form appears in the same frame as the record list.
• LFVFFM - View/Insert Form Frame defines the frame in which the
view and insert forms appear; if this preference is blank, these forms appear in the
frame after the record list. If the record list appears in the last frame, all three

.....................................................................................................................................................
6-24 Oracle Designer 6i: Web PL/SQL Design and Generation
Invoking a Custom Frameset
.....................................................................................................................................................

forms share the same frame (but not at the same time).
• LFLVFM - List of Values Frame defines the frame in which lists of
values appear (that is, LOVSTL is set to FRAME); if this preference is blank, the
LOV appears in the frame after the view/insert form.
• LFHDFM - Header Frame defines the frame in which the page header
appears; if this preference is blank, the page header appears in the first frame.
• LFFTFM - Footer Frame defines the frame in which the page footer
appears; if this preference is blank, the page footer appears in the last frame.
If you map more than one generated page to the same frame, the generator creates
navigation buttons to enable you to move between them.

.....................................................................................................................................................
6-25
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Summary

Summary

• Adding user text to modules and module


components
• Formatting user text
• Formatting columns
• Including standard headers and footers
• Setting document attributes
• Using document templates and cascading style
sheets
• Using framesets

6-26

User Text
The Web PL/SQL Generator makes use of user text defined against modules or
module components:
• You can embed HTML directly into your user text. However, you need to set the
MODSUB preference to enable the generator to recognize it.
• You can embed calls to functions in the HTF package within your user text.
• You can also embed calls to functions in your own custom packages, but you must
identify the packages to the generator using the PKGLST preference.

Standard Headers and Footers


You can define standard headers and footers through preferences. They can appear on
every page in the module.

Document Attributes
You can use document attributes to vary the colors of the page background, the page
text, and standard, visited, and active hyperlinks. You can also define the background
image for the page.

Document Templates
Document templates are more flexible than document attributes. You can use them to
influence the appearance of generated and static pages.
You can define that the templates use cascading style sheets for even more flexibility.

.....................................................................................................................................................
6-26 Oracle Designer 6i: Web PL/SQL Design and Generation
Summary
.....................................................................................................................................................

Framesets
The generator generates HTML frames for module components with List/Form layout.
For the default frameset, you can define the number and relative sizes of the frames.
You can create a document template that defines a custom frameset. Preferences map
its frames to generated and static pages.

.....................................................................................................................................................
6-27
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Practice 6—1: Adding Static Text and Images


Goal
In this practice, you enhance an existing Web PL/SQL module by adding formatted
user text and code that displays static text and images.

Scenario
You have captured the design of a form and modified it slightly for use as a Web
PL/SQL module. As customers must use the module on the Web without training or
support, you should provide more descriptive information on the Web pages. You
should also include some of Hollywood’s branding information.

Your Assignment
Use the following information as your starting point:

Workarea Continue using the same workarea if you


have completed all practices or switch to
rescue workarea ORA<nn>_Les06_stp
Module REN0020 - Reserve a Title

where <nn> is the group number that your instructor has assigned to you.
1 Use the Design Editor to modify the startup page to look like the following:

Note: You will find the image files in the graphics folder on the Web server.
Its parent directory is mapped to /webapp.

.....................................................................................................................................................
6-28 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 6—1: Adding Static Text and Images
.....................................................................................................................................................

a Add the following user text:

User Text Area Value


Default Area <i>This module enables you to browse through video and
game titles.</i>
Top of First htf.img(‘/webapp/graphics/hollywood.gif’)
Page
Bottom of First htf.small(‘If you have trouble using this page, please email ’||
Page htf.mailto(‘cs@hollywood.com’, ‘Customer Services’)||’.’)

bSet a module level preference to set the background to /webapp/graphics/


background.gif.
2 Generate, install, and run the module. If you can see HTML tags, set the
preference that governs whether or not the generator recognizes HTML markups.

.....................................................................................................................................................
6-29
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Practice 6—2: Adding Standard Headers and Footers


Goal
In this practice you enhance an existing Web PL/SQL module by adding standard
headers and footers using a custom function.

Scenario
The company wants the Hollywood image to appear at the top of every page of every
module. They also want some standard information at the bottom of every page. You
are to implement this, using a custom function to create the footer.

Your Assignment
Use the following information as your starting point:

Module REN0020 - Reserve a Title

You are going to amend the module so that it looks like this:

Add a Standard Header


1 Move the information from the Top of First Page user text area to the standard
header preference in the GENERAL preference set
Note: The GENERAL preference set is used at application system level.
2 Ensure that the standard header appears at the top of every page.
3 Generate, install, and run the module.

.....................................................................................................................................................
6-30 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 6—2: Adding Standard Headers and Footers
.....................................................................................................................................................

Add a Standard Footer


4 Remove the information from the Bottom of First Page user text area.
5 The standard footer is created by calling a custom function.
a Use a text editor to look at the code in the file docs/holly_pkg.sql in your
working directory. What are the names of the functions in this file?
b Install the HOLLY_HTML package from this file, using SQL*Plus.
6 Modify the GENERAL preference set to use the footer function on all pages.
7 Set the standard footer preference to call the STD_FOOTER function from the
HOLLY_HTML package (use <package_name>.<function_name>).
8 Set a preference to tell the generator that the HOLLY_HTML package exists.
9 View the Generator Preferences for the module REN0020. How can you tell
whether the preferences you have set for the GENERAL preference set have been
applied to the module?
10 Generate, install, and run the module.

.....................................................................................................................................................
6-31
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Practice 6—3: Formatting Column Values


Goal
In this practice you add formatting to bound items within a module.

Scenario
Customers have their photographs taken when they join Hollywood. This photo should
be displayed on the customer record and should provide the hyperlink from the record
list to the view form.
The marketing department would like to encourage a club atmosphere amongst
customers. To facilitate this, email addresses should also be displayed on the record
list and they should invoke an email program when clicked.

Your Assignment
Use the information below as your starting point:

Module MEM0010 - Maintain Personal Details

1 Modify the reusable module component CUS_RMC to display PHOTO_FILE as the


first item on the record list.
2 Change the formatting of the PHOTO_FILE item so that the image is displayed
rather than the name of the file and ensure that it is a context item.
3 In the GENERAL preference set, add /webapp/photos/ as the default image
location.
4 Modify the reusable module component CUS_RMC to display EMAIL on the record
list.
5 Change the formatting of the EMAIL item so that it invokes an email program when
clicked.
6 Generate, install and run the module to answer these questions:
a Why do the Hollywood logo and the footer appear in this module?
b Does the photograph appear on the record list?
c Can you email a customer by clicking on the email address?
d On the view form, why can you not amend the name of the photograph file?
e On the view form, why can you amend the email address?

If you have time:


7 Display the record list rows in alphabetical order of the customer’s name.
8 Display fewer rows on the record list.
9 Remove the table border from the record list.

.....................................................................................................................................................
6-32 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 6—4: Using a Style Sheet
.....................................................................................................................................................

Practice 6—4: Using a Style Sheet


Goal
In this practice, you add a document template to a Web PL/SQL module.

Scenario
After successfully adding the standard header and footer to all the Web pages, you
now want to standardize on the background and text colors.

Your Assignment
Use the following information as your starting point:

Module MEM0010 - Maintain Personal Details

Apply a Template Directly to a Page


1 The docs folder in your working directory contains a template file, les06.tpl.
Look at it in a text editor to see the values set in the style tag. The font colors are
varying shades of blue (except for the red active link).
Note: There is a chart of hexadecimal color values in the Help system; navigate to
About color in Web PL/SQL applications. Not all browsers support all entries in
the style tag.
2 Copy this file into your working directory.
3 In the Design Editor, set the Document Templates preferences for the MEM0010 -
Maintain Personal Details module. Map the startup page and the record list
to les06.tpl.
4 Generate, install, and run the module to answer the following questions:
a What color is the title text on the startup page and record list?
b What color is the background image on the startup page and record list?
c What color is the title text on the view form?
d What color is the background image on the view form?
5 What do you have to do to change the background image? What would be a more
efficient implementation, with respect to development time?

Apply a Style Sheet Indirectly


6 The docs folder in your working directory contains the following three text files:

Filename Contents
les06.txt A link to a cascading style sheet, les06.css

.....................................................................................................................................................
6-33
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Filename Contents
les06a.css A style sheet that specifies the mauve Designer background image and
blue text
les06b.css A style sheet that specifies a textured blue background image and olive
text

7 Copy les06b.css and les06.txt into your working directory and examine
them in a text editor.
8 Rename les06b.css to les06.css.
9 In the Design Editor, set the Document Templates preferences in the GENERAL
preference set. Map all the pages to les06.txt.
10 Generate, install, and run the module. Can you see your changes?
11 In the Design Editor, set the Document Templates preferences for the MEM0010 -
Maintain Personal Details module to the default for the application.
12 Generate, install, and run the REN0020 - Reserve a Title module. Can you
see your changes?
13 Copy les06a.css to les06.css.
14 In the browser, reload the current module. Can you see your changes?

.....................................................................................................................................................
6-34 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 6—5: Creating a Custom Frameset
.....................................................................................................................................................

Practice 6—5: Creating a Custom Frameset


Goal
In this practice you apply a custom frameset to a module.

Scenario
Market research indicates that customers have to go through too many pages to get to
the information they want. One of your colleagues has created a style sheet that
defines a frameset. You are to experiment with this frameset.

Your Assignment
Use the following information as your starting point:

Module REN0020 - Reserve a Title

1 Using a text editor, view the contents of the frameset file, frame06.tpl,
which is in the docs folder in your working directory.
a What are the names of the frames?
b Draw a rough sketch of how you expect the screen to be divided.

2 Set the TITLES module component to display in frames.


3 Set the generator preferences at module level:
Use a custom frameset.
a
b Specify that the query form should be in a frame.
4 Map the generated pages to the appropriate frames:

.....................................................................................................................................................
6-35
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Specify that you want to use the frame06.tpl file in your working
a
directory.
b Set the query form and record list to appear on the left.
c Arrange for the insert and view forms to appear on the right.
d Map the default text, module content, and header to the top frame.
e Map the footer to the bottom frame.
5 Generate, install, and run the module to answer these questions:
a In which frame does the query form appear?
b Execute a query. In which frame does the record list appear?
c Click on any record. Where does the view form appear?
d Click the New button. Where does the insert form appear?

If you have time:


6 Remove some of the items from the record list (they are not necessary as you can
see additional information in the view form when you click on the context
hyperlink).
7 Remove the context information from the view form (it is not necessary as the
forms are now all displayed at once).
8 Change the layout of the view form so that the user does not have to scroll down to
see the information.
9 Use break groups to separate movies from games on the record list.

.....................................................................................................................................................
6-36 Oracle Designer 6i: Web PL/SQL Design and Generation
Hints
.....................................................................................................................................................

Hints
Practice 6—1
To perform this task Follow these steps
To modify user text 1 Select the module or module component.
2 Invoke the property dialog.
3 Select the User Text tab.
4 Click on the appropriate location.
5 Enter the text into the User text area.
6 Click Finish.
To set the background 1 Open the Web PL/SQL Generator Preferences Navigator.
image 2 Navigate to the Document Attributes category.
3 Set the MODBGR – Background Image File preference
to the virtual path and name of the required file.
To ensure that HTML 1 Open the Web PL/SQL Generator Preferences Navigator.
is interpreted by the 2 Navigate to the Text Handling category.
browser 3 Set the MODSUB – Substitute HTML Reserved
Characters preference to No.

Practice 6—2
To perform this task Follow these steps
To specify a standard 1 Open the Web PL/SQL Generator Preferences Navigator.
header 2 Navigate to the Headers and Footers category.
3 Set the MODSHA – Standard Header On All Pages
preference to Yes.
4 Set the MODSHD – Standard Header preference to the
required header value.
To install a custom 1 Invoke SQL*Plus as the Web PL/SQL user.
package 2 Run the SQL file that contains the package definition.
To use a custom 1 Open the Web PL/SQL Generator Preferences Navigator.
package 2 Navigate to the Text Handling category.
3 Set the PKGLST - PL/SQL Package List preference to
the name of the package.
To specify a standard 1 Open the Web PL/SQL Generator Preferences Navigator for
footer the module.
2 Navigate to the Headers and Footers category.
3 Set the MODSFA – Standard Footer On All Pages
preference to Yes.
4 Set the MODSFT – Standard Footer preference to the
required header value.

.....................................................................................................................................................
6-37
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Practice 6—3
To perform this task Follow these steps
To change the order 1 Invoke the display view of the module diagram.
of items 2 Drag the item to the required position.
To add formatting to 1 Select the displayed item.
an item 2 Invoke the Edit Item dialog.
3 Select the Display tab.
4 Set the Formatting property as required.
5 Click the Finish button.

Practice 6—4
To perform this task Follow these steps
To map a page to a 1 Open the Web PL/SQL Generator Preferences Navigator.
document template 2 Navigate to the Document Templates category.
3 Set the template filename preference for the appropriate page
to the directory (relative to the working directory) and file
name of the template.
To reset a generator 1 Open the Web PL/SQL Generator Preferences Navigator.
preference 2 Select the required preference.
3 Right-click and select Inherit from the menu.

.....................................................................................................................................................
6-38 Oracle Designer 6i: Web PL/SQL Design and Generation
Hints
.....................................................................................................................................................

Practice 6—5
To perform this task Follow these steps
To display a module 1 Navigate to the Edit Module Component dialog.
component in frames 2 Select the Display tab.
3 Set the Layout Style to List/Form.
To use a custom 1 Open the Web PL/SQL Generator Preferences Navigator.
frameset 2 Navigate to the Frames category.
3 Set LFCUST – Use Custom Frameset to Yes.
4 Navigate to the Frames - Custom category.
5 Set LFFSTP – Custom Frames: Template Filename
to the virtual path and name of the template file.
To display the query 1 Open the Web PL/SQL Generator Preferences Navigator.
form in a frame 2 Navigate to the Frames category.
3 Set LFQOSP – Place Query Form on Separate page
to No.
To map pages to 1 Open the Web PL/SQL Generator Preferences Navigator.
frames 2 Navigate to the Frames - Custom category.
3 Set the Frame preferences to the (case-sensitive) name of the
appropriate frame.

.....................................................................................................................................................
6-39
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Instructor Notes

Schedule

66 Timing Topic
Im p lem enting U ser In terface S tan d ards 60 minutes Lesson
60 minutes Practice
120 minutes Total

Class Management
O verview
This chapter is not complex. Rather, it offers


C an I a d d text to m o d u le s?
H o w d o I form at te xt?
the potential to create interesting Web pages.
• H o w d o I form at co lum ns ?
• H o w d o I ad d a sta n dard h ead er and fo o te r to m y Refer to the plain style of pages we have
a pp licatio n ?
• H o w d o I m ak e all m y p ag es lo ok th e sam e? seen so far. Discuss why you might
• H o w d o I see m o re than o ne p ag e at a tim e?
want to apply standards, to make
different pages look dissimilar, or to see
6-2
more than one page at a time.
Demo
T ypes of U ser Text
In your browser, invoke the demonstration
Im age
S tatic
Text
system. Point out the images, URL, and static
W e lcom e!!
text on the startup page.
U
URRLL


Film R eview s
D isney Do not show the source code. Leave the
M ailto
D o you have any que stions? E m a il browser open and use it to show the source
H ollyw ood V ideo

code later in the lesson.


6-3

Class Management
D efin ing U ser Text
D e fine in the D e sign E ditor . . . Discuss the difference between using the
U ser Text property palettes and the property dialog to
U s er text can be display ed...

D efault A rea H TP .B O L D (‘W eb P age T ext’) enter user text.


Top of R e cord List <ul><li>B ullets < /li>
</ul> …

Demo
W eb P age Text

. . . generate in to a
• B u llets
• Im a ges You could add text using the property dialog
W eb P L/S Q L m odule
6-4
and then view it in the property palette.

.....................................................................................................................................................
6-40 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Class Management
C ontrollin g th e Lo catio n o f U ser T ext

D efault
Usually you open and close the tags for each
A re a
area, such as Top of Record List,
independently. However if you open a tag in
Top of
R ecord List
one area for a page, Top of Record List, and
B ottom of
R eco rd List
close it in the other, Bottom of Record List,
then the tag applies to the whole page (but not
6-5 to the column data).
Class Management
H yp erT ext M arkup Lan g uag e
Explain briefly about HTML. There is a lot of


P roces sed b y W eb b ro w sers
T ells a brow ser h o w to p ain t th e screen
information available in books and on the Web,
• U ses tag s to d efin e:
– H e adin g s < H 1> < /H 1>
if students are interested in pursuing the


Im a g es
URLs
< IM G S R C =“im g.g if”>
subject.
S end em ail to
H olly@ v ideo.c om
V isit ou r W eb site
H ollyw o od V id eo

6-6

Class Management
E m bedd in g H TM L
You can e mbed <b >HTM L</ b> into
your :
By setting the preference, you direct the
U ser Text <ul> <li >M odule U ser Tex t. </li>
<li> Pag e User Te xt.< /li >
</ul >
generator that the HTML tags need to be
interpreted and not read as plain text.
M O D S U B =Y M O D S U B =N
(defa ult)

Y ou can em bed <b> H TM L</b> Y ou can em b ed H TM L into your:


Y ouyour:
into can em bed <b >H TM L</b> Y ou can
• M odule emText.
U ser bed H TM L into
your:
into your:od ule U se r Text.</li>
<ul><li>M • P age U se r Text.
<ul><li>M o dule U ser Text.</li> • M odule U se r Text.
<li>P age U ser Text.</li></ul>
<li>P age U ser Text.</li></ul> • P age U ser Text.

6-7

Class Management
U sing the T oolkit P rocedu res
You discussed the Developer’s Toolkit briefly
If y ou need he lp , con ta ct
U ser Text <I>h tf. mail to( ’c s@hol ly wood .com ’,
‘Cu st omer Ser vi ces’) </ I>
in an earlier lesson. You can go into more
detail here.
htp. p(‘ If y ou ne ed he lp , co ntac t <I>’| |

P L/S Q L
htf .m ailto (’ cs@h olly wo od.co m’ ,
‘Cu st omer Ser vi ces’) ||
Information about Web server implementations
’</I >’) ;

If y ou need he lp ,
is available on the intranet. The online
W eb P age
cont act Cus tome r Servi ce s
documentation gives a full breakdown and
6-9
description of the Toolkit packages.
Class Management
U sing C u sto m F un ction s
If you omit the package name from the list the
1. W rite a fun ctio n tha t retu rns H T M L .
2. P lace th e fu n ctio n in a p ackag e.
Generator does not use the package: the text is
3. S e t th e P K G L S T p referen ce.
4. U s e th e fu n ctio n in u ser text.
printed to the screen.
HT F.HR Th is is s ome tex t.
my _htm l.c ust (‘Th is text is a para met er
If you want to include several packages, you
to the fu nct ion. ’)
separate their names by commas.

6-10

.....................................................................................................................................................
6-41
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Class Management
V irtu al D irecto ries
Note that the mapping is a function of the Web
holly
server, not the Generator. This is included to
w ebapp
give a brief idea of how it works. If a directory
im ag es do cs is mapped, you can refer to subdirectories
V irtu al D irecto ry P h ysical D irecto ry
without mapping them specifically.
/graph ics /holly/w ebapp/im ages
If you use the physical directory, it is very
6-11
restrictive when deploying applications.
Class Management
F o rm attin g C olum n s

E m ployees
101, N iall John
E m ail
E m p Id: 101 form a tting
Last N am e: John
First N am e: N iall
E m ail: njohn@ hollyw ood.com B old
P osition: M anager form a tting
P hoto:

Im age
form a tting

6-12

Demo
G raph ical R eco rd List
Your directory includes files (CVWGRAPHIC) to
install a version of this module. When you run
it, the Customer Id may also appear on the
record list. In the version we built against, we
could not generate when the only context item
was formatted as an image.
6-13

About the Slide


H eaders an d Fo oters
G enerato r P refere nces
The slide shows two ways of creating standard
S et footer on
P rod uct
all page s headers and footers: the footer is a call to a
MODSFA Y es custom package and the header is a call to the
MODSFT m yH T M L.m yFooter
MODSHA No HTF package.
MODSHD H TF.B O LD (‘text’)

S et header on
S tartup page on ly

6-14

Demo
D o cum ent A ttributes
R eserve a Title M O D FG C
text color
Show how to get to the color chart in the online
U se these pages to enter
M O D V LC
visite d link
booking d etails:

B O O K IN G S
MODBGC
backgroun d
help:
• A bout color
E nter qu ery criteria
for B O O K IN G S : M O D S LC
• Select one of the Generator preferences in
M O D A LC
active link
B ooking N o:
Title: LO V
standard link
the Document Attributes category.
• R eturn

S et colors a s hexad ecim al


FF 0000 : red
• Select contextual help.
00 00FF : blue
value (R R G G B B ) 00 FF00 : green

6-15
• Click on Color Chart.

.....................................................................................................................................................
6-42 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

About the slide


D ocu m en t T em p lates
R eserve a T itle This slide shows a before and after scenario.
U se these pages to enter
booking details:

B O O K IN G S
4 GUGTXGC6
Q U E R Y FO R M
Q U E R Y KVNG
FO R M
D
Default
efault Tem
Template
p late
8 V H W K H V H S D J H V W R H Q W H U
The document template changes the fonts for
:
• A bout
E nter query criteria for
E R R N LQ J G H W D LO V

$ 1 1 - +0 ) 5
the page title and help text and adds a
B O O K IN G S:

B ook ing N o:
• A bout
E nter query criteria for background image.
T itle: B O O K IN G S :

Booking No:
T itle: LOV
You could have a separate template or
A pply tem plate
style sheet for each page, for example,
6-16
Query and Insert pages could have
different templates.
About the slide
H T M L E lem ents

R eserve A Title
The first slide is not in the student manual. It
B ody < B O D Y > U se these pages to m aintain de tails
of B O O K IN G S may help you to explain which tags affect
H eading <H 1> B O O K IN G S
E n ter query crite ria for
B O O K IN G S
which areas on the page.
P aragraph <P >

xxxx xxxx
xxxx xxxx
Table < TA B LE >
xxxx xxxx
xxxx xxxx

xxxx xxxx

6-17

C reatin g a T em plate F ile The second slide shows the format of the style
• U se text ed ito r
tag.
• S et p aram eters fo r each H T M L elem en t
<H TM L >
<H E A D >
<S TY LE >
B O D Y {font:1 2pt A rial; back ground: yello w ;
color: red}
H 1 {font: 18p t A rial; font-w e ight: bold; co lor: blue}
P {font: 10pt A rial; font-w eight: bold; colo r: red}
</S TY L E >
</H E A D >
</H TM L >
6-18

Class Management
U sing a C ascad ing S tyle Sh eet
Emphasize that style sheets are a very
D ocum ent te m plate

<link rel=styleshee t type="text/c ss" hre f="m ysty les.css">


powerful way to enhance generated
pages. However, this course is designed
C ascad ing style s heet

<S TY LE > to teach how the generator uses style


B O D Y {font:12pt A rial; background: yellow ;
color: red}
H 1 {font: 18pt A rial; fo nt-w eight: bold; color: b lue}
sheets; we are not teaching them about
P {fo nt: 10pt A rial; fon t-w eight: bold; color: red }
< /S TY LE >
cascading style sheets. Different
6-19 browsers handle style sheets differently.
Further information on style sheets is
available on the Web:
www.w3.org/Style Sheets
www.hotwired.com/webmonkey/
Style_Sheets
www.microsoft.com/typography/
css/gallery/

.....................................................................................................................................................
6-43
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Class Management
A p plying T em p lates
The template files can be anywhere on the
G enerator
enerato r P references

P rod uct
network. They do not have anything to do with
Insert Form
D o cum ent Tem p lates the Web server.
Q u ery Form D O C T IF iftem p.txt
D O C T LV lvtem p.txt
DOCTQF qftem p.txt
R ecord List
DOCTRL rltem p.txt Demo
V ie w Form DOCTVF vftem p.txt

Use the Generator Preferences palette to show


6-20
how the pages are mapped to a document
template.
About this Slide
D efault F ram eset

B row ser:
This slide illustrates the default frameset. The
http://w w w ....

V iew
participants should already have seen this in
form
UPPER
Lesson 5 (when they changed the module
LE FT R IG H T

Insert
component display style to List/Form).
R ecord form
LO W E R
list

U se preferen ces to alter p ro p o rtion s


(F R A M E S - D efault)

6-21

Class Management
D efin in g F ram e S izes

P ercen tage R elative A b so lu te


You can’t mix the sizing methods in one tag.
LFR O W S : 25 % , 75% LFR O W S : *, 3* LFR O W S : 1 00, *

Top

R ecord list V iew fo rm

6-22

About this Slide


B uild in g a F ram eset
The slide uses animation to show the start and
<H T M L >
<F R A M E S E T R O W S = "30% , 50% , 20% ">
< F R A M E N A M E = "U P P E R "> First row
end of each tag. Emphasize that the nested
(3 0% )
< F R A M E S E T C O L S = "30 % , *">
<F R A M E N A M E ="L E F T"> S econd
frameset of two columns replaces the middle
<F R A M E N A M E ="R IG H T ">
< /F R A M E S E T >
ro w (50% )
row and the row does not have a name.
< F R A M E N A M E = "L O W E R " Th ird row
(2 0% )
S R C ="c:\foo te r.txt">

</FR A M E S E T >
</H T M L>
Class Management
6-23
A frame can derive its content from static files
such as text files or images. Not every frame
has a generated page as its source.
For a tutorial on the use of framesets
see:
http://www.hotwired.com/
webmonkey/html/

.....................................................................................................................................................
6-44 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Class Management
D isplaying a Fram eset
This is the result of the frameset we built in the
UPPER previous slide.
30% row s

LE F T R IG H T
50% row s 5 0% row s
30% cols * c ols (70% )

LOW ER
20% row s

6-24

Class Management
M ap pin g Pag es to Fram e L o catio ns
If LFFSTP is blank, the generator uses the
G enerator P referen

Prod uct
ces
references
default frameset.
D efault text

Tem plate
Fram es - C u stom
L FD TFM UPPER
Demo
L FFS TP fram e.h tm
R ecord list L FQ FFM
L FR LFM
LEFT
LEFT
Use the Generator Preferences palette to
V iew form L FV FFM R IG H T
show how the pages are mapped to
frames within the frameset. Emphasize
6-25

that more than one page can be mapped


to the same frame. They replace each
other and the generator creates
navigation buttons to move between
them.
Class Management
S um m ary

• A d d in g user text to m od u les a nd m o d u le


c om po nen ts
• F orm attin g u ser te xt
• F orm attin g c olu m n s
• In clu d in g stan d ard h ead ers an d fo o ters
• S ettin g d ocu m en t attrib u tes
• U sing d o cum en t tem plates an d cascad ing style
s heets
• U sing fram esets

6-26

Practices
The physical client files directory is mapped to the /webapp virtual directory. It then
has subdirectories to which you refer as /webapp/docs, /webapp/graphics, etc.

Practice 6—4
If the students cannot see the changes when they reload the form after changing the
style sheet, tell them to exit the browser and reload it (to clear the cache).

.....................................................................................................................................................
6-45
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

.....................................................................................................................................................
6-46 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Post Lesson Teaching Evaluation
.....................................................................................................................................................

Instructor Post Lesson Teaching Evaluation


Name: Full Email:

Course Name: Oracle Designer 6i: Web PL/SQL Design and Generation
Lesson number: 6
Number of teaches before filling this form: 1 - 2 - 3 to 5 - >5

Global comments: (circle all that apply)


• Lesson content: Trivial - Too easy - OK - Difficult - Too difficult
• Slide content: Too many slides - Too few slides - O.K
• Text content.Too much text - Not enough text - Unclear - O.K.
• Practice content: Too difficult - Too easy - Problems - O.K.

Detail comments
Content type: Slide - Text - Practice - Instructor notes
Note: 1:needs animation - 2:too much animation - 3:needs more text - 4:too much text
- 5:Unclear - 6:not necessary - 7:Other

Content Page
Note Comments/Suggestions
Type Number

Photocopy this page and fax to: Oracle Designer Curriculum Development @ +(44) 118.924.5181
Additional sheets are available at the end of the instructor’s guide.
If you draw additional diagrams on the white board use the Graphic sheet in the Instructor Evaluation
section at the end of this book.

.....................................................................................................................................................
6-47
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

.....................................................................................................................................................
6-48 Oracle Designer 6i: Web PL/SQL Design and Generation
Suggested Graphics
.....................................................................................................................................................

Suggested Graphics
Instructor name: Full email:

Course Name:Oracle Designer 6i: Web PL/SQL Design and Generation


Lesson No: 6 Page No:
Please sketch your additional diagram below.

.....................................................................................................................................................
6-49
®
Lesson 6: Implementing User Interface Standards
.....................................................................................................................................................

Oracle Designer Education Products


Curriculum Development
520 Oracle Parkway
Thames Valley Park
Reading - Berkshire
England

fold here

.....................................................................................................................................................
6-50 Oracle Designer 6i: Web PL/SQL Design and Generation
7
.................................

Building More Complex


Modules
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Introduction
In this lesson you learn how to build master–detail modules and generate Lists of
Values. You simplify the navigation within a master–detail module and add master
context information. You also define and use Repository LOV elements and GUI
display items to ensure that users only enter valid values. LOVs, GUI display items,
and pop-up calendars also improve the look and functionality of your generated
applications.
Class
Overview Management
See Page 37
Practice
• How do I build a master–detail module? See Page 37
• How do I provide data entry help to the user?
• Can I insert and update multiple records?
• How do I control what a user enters?
• Can I use a calendar to populate a date item?

7-2

Topic See page


Introduction 2
Placing the Detail Record List 4
Providing Master Context Information 8
Lists of Values 10
Adding a List of Values to a Module 12
Refining a List of Values 15
Controlling the Display of Lists of Values 19
Updating and Inserting Multiple Records 20
Controlling User Input 22
Summary 25
Practice 7—1: Examining a Master–Detail Module 26
Practice 7—2: Reducing Pages in a Master–Detail Module 27
Practice 7—3: Adding Contextual Information 29

.....................................................................................................................................................
7-2 Oracle Designer 6i: Web PL/SQL Design and Generation
Introduction
.....................................................................................................................................................

Topic See page


Practice 7—4: Adding Lists of Values 30
Practice 7—5: Creating Multiple Row Insert Pages 32
Practice 7—6: Using Default Values and Calendars 33

Objectives
At the end of this lesson you should be able to do the following:
• Create layouts for master–detail modules
• Create Lists of Values components using the default utility
• Create and refine LOVs manually
• Work with multirow DML
• Control user input using allowable values
• Use GUI display items
• Implement a pop-up calendar

.....................................................................................................................................................
7-3
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Placing the Detail Record List


The Web PL/SQL Generator generates a set of pages for each module component in a
master–detail structure. The number and type of pages generated for each component
depends on the operations set for each module component. The generator generates
two Record Lists: one for the master module component and one for the detail module
component. You can choose to place the Record List for the detail module component
on the View Form for the master module component or on a separate page.

Class
Master–Detail Layout Management
See Page 37
Master

• Record List:
– Master
– Detail

• Detail Record List:


– On separate page
– On master View Form

Detail
7-4

.....................................................................................................................................................
7-4 Oracle Designer 6i: Web PL/SQL Design and Generation
Placing the Detail Record List
.....................................................................................................................................................

On a Detail Record List Page


If the user can query on the detail module component, the generator creates a query
form for it. The detail query form is called from the master view form and the detail
record list cannot appear on the master view form. You must place the detail record list
on a separate page.
If the user cannot query on the detail module component, you can still choose to place
its record list on a separate page. Use the display view mode of the Module
Diagrammer to ensure that the master module component and the detail module
component appear in different windows.

Class
Detail on Separate Page Management
Page header
See Page 37
Title
Demo
View form
See Page 37
Detail hyperlink

Page footer

Page header
Title
Record list

Page footer

7-5

Master–Detail Navigation You navigate to the detail Record List by clicking on the
hyperlink at the bottom of the master View Form.

Number of Connections Required The detail Record List appears on a separate


HTML page from the master View Form. You require a separate connection to the
Web server and a separate database session to obtain and display each page. This
involves more network traffic than when the detail Record List appears on the same
page as the master View Form.

.....................................................................................................................................................
7-5
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

On the Master View Form


If the detail module component is not queryable, you can place its Record List on the
same page as the master View Form.
Use the display view mode of the Module Diagrammer to ensure that all displayed
items appear in the same window.

Demo
Detail on Same Page See Page 38

Page header
Master Title
View form

Record list

Detail
Page footer

Detail module component cannot be queried

7-6

Master–Detail Navigation You navigate to the detail View Form by clicking on a


hyperlink in the detail Record List.

Number of Connections Required The detail Record List appears on the same
HTML page as the master View Form. Therefore, you require only one connection to
the Web server and one database session to obtain and display the information. This
involves less network traffic than displaying the information on separate pages.

.....................................................................................................................................................
7-6 Oracle Designer 6i: Web PL/SQL Design and Generation
Placing the Detail Record List
.....................................................................................................................................................

Navigating to Multiple Detail Module Components


Use the ZONLDL – Record List: Add detail hyperlinks to Record List
preference to specify navigation from the master Record List to one or more detail
Record Lists. Set it to ensure that each row of the master Record List displays a
hyperlink to each of the detail Record Lists.

Class
Master–Detail Navigation Management
See Page 38
Title Links to Detail
Help Record List

Col 1 Col 2 Col 3 DETAIL DETAIL

2001 xxx xxx Copies Book

2002 xxx xxx Copies Book


Link to xxx xxx
View form 2102 Copies Book

First Previous Next ReQuery Count


Set preference
Query New
ZONLDL

7-7

.....................................................................................................................................................
7-7
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Providing Master Context Information


Master context information is information that shows the master–detail relationship
between module components.
For example, the slide shows three module components that are connected by key-
based links. Each work group may have one or more employees and each employee
may have one or more requests. The work group and employee module components
are masters of the request module component.

Displaying Master Context

Work Group 20
Client Side Generators
Oracle Designer
TVP
Employees PSE
12-Mar-1990
Griffiths
Requests
Requester’s
Comment::
Start Date:
End Date: to:
Half Day:

Find Clear New

7-8

The ability to maintain master context information means that you can:
• Access master module component item values from LOVs, user text, unbound
items in SQL expressions, SQL text (WHERE, HAVING, and CONNECT BY
clauses), user-defined application logic
• Customize dynamic return links
• Control the formatting of a component's header and footer text.

Setting up Master Context Information


The generator preferences in the Master Context category control the use of the master
context information.
To make master context available, set the MCNMDP – Maintain context to this
depth preference. In a module with three linked components and MCNMDP set to 1,
when a page for the second component is displayed, item values from the first
component are available. However when a page from the third component is

.....................................................................................................................................................
7-8 Oracle Designer 6i: Web PL/SQL Design and Generation
Providing Master Context Information
.....................................................................................................................................................

displayed, only values from the second component are available. In order to use item
values from the first and second components in a page from the third component,
MCNMDP must be set to 2.
Set the MCNAAC – Always add code preference to ensure that master context code is
always added to a module, even when the module does not use it. Set this preference if
a called module needs to display the master module’s context information.

Using Master Context Information with User Text


The simplest way to use master context information is to include it in user text. In the
detail module component, set the user text and refer to the required context items.

Using Master Context Information with a User-Defined Package


If you want to use a specific package to format the master context information, you
must set the following preferences:
• Set the MCNDPK – Display package preference to the name of the PL/SQL
package that displays the context information.
• Set the MCNDDP – Display depth preference to reduce the number of levels of
context that you display via the display package. By default the display package
passes a display depth that is the same as the value in MCNMDP, however you
may want to maintain more context information than is displayed. The value for
MCNDDP should be equal to or less than the value of MCNMDP.
For example, a piece of application logic may require a component two levels
above to have the correct item values but you wish to display only one level in
your generic display procedure. In this case you would set MCNMDP to 2 and
MCNDDP to 1.
• Set the MCNFRM – Forms requiring context preference to define which forms
should display master context. Usually this only applies to detail components, but
you can set it for master components because one display package can format
context data for a component and its masters.
• Set the MCNCVL – Custom value preference to define a PL/SQL expression that
is saved to the custom property in the master context display data. The display
package reads this value and uses it to control the format of the output. This
preference is not inherited; you must use it explicitly. For example, if you set a
value at module level, it is not set against the components or items in the object
cache.

Technical Note
Only user-defined application logic can reference master component items.

.....................................................................................................................................................
7-9
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Lists of Values
A list of values (LOV) makes it easier for a user to enter or query on data. Oracle
Designer 6i enables you to model LOV components and associate them with items.
The Web PL/SQL Generator can use these components to create LOV windows in
generated applications.

LOV Structures

Module component LOV component

LOV
association

LOV
inclusion

7-9

What Is an LOV Inclusion?


An LOV inclusion describes one instance of the use of an LOV component in a
module. One LOV can have many inclusions in a module. An LOV is generated into
the Web PL/SQL module for each LOV inclusion.

What Is an LOV Association?


You can associate an LOV inclusion with an item in a module component. If you do
not associate an inclusion with any item in the module component, the LOV is still
generated into the form, but it will not be displayed unless you write application logic
to call it.

.....................................................................................................................................................
7-10 Oracle Designer 6i: Web PL/SQL Design and Generation
Lists of Values
.....................................................................................................................................................

Example of an LOV Component


Class
LOV Inclusions Management
See Page 39
• Are associated with up to one bound or unbound
item
• May be used for Query and Data Entry
• Can have an Additional Restriction clause
• Can have a return list

RTL_LOV
<Unassociated>
RTL_ID
A_MC.RTL_ID RTL_DATE

One LOV can have many inclusions in a module.

7-10

The COPIES_LOV component has two inclusions, so the Web PL/SQL Generator
generates two LOVs.
One of the inclusions has been associated with items and is defined in the LOV
property of the item. The other LOV is generated but can only be invoked from
application code.

Deleting LOV Inclusions


Beware of inadvertently deleting a specific LOV component. If you delete the only
inclusion of an LOV from the repository, the LOV component is also deleted. To avoid
inadvertently deleting an LOV, create an unassociated inclusion before deleting the
last association.

.....................................................................................................................................................
7-11
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Adding a List of Values to a Module


You can use the Default Lists of Values utility to automatically create the LOVs that a
module requires. You can add a new LOV to a module diagram data view.

Using the Default Lists of Values Utility

Using the Default LOV Utility


Utilities Generate
Group Items...
Remove From Group...

Resequence...
Default List Of Values Utility
Copy Object... Context object for which Lists of Values will be created
Copy With new Language Module REN0010 (WG_HOLLYWOOD)
Force Delete...
Map Unbound Items á Use Reusable Lists of Values
To use Reusable Lists of Values from outside the container of the
context object, specify the search path in the Additional Containers
Default Links… field below.
Additional
Default Lists of Values... Containers
Browse...

Validate
á Reuse existing Lists of Values defined within the module.
á Create Reusable Lists of Values for Reusable Module Components.
Create Reusable Lists of Values for Module Components defined
within the module.

Start Cancel Help

7-11

You can run the Default List of Values utility against a module, a module component,
a subcomponent, or a table usage. Select the object for which you want to create an
LOV and then select Utilities—>Default List of Values from the menu to invoke the
utility’s dialog box. The selected object is shown in the Context Object field. The
check boxes enable you to influence how the utility works.

Check box Behavior


Use Reusable Lists of Values Creates associations from any suitable Reusable LOVs
Reuse existing LOVs defined Creates associations from any suitable LOVs defined
within the module within the module
Create Reusable LOVs for Creates reusable LOV components for any reusable
Reusable Module Components module components included in your context object
Create Reusable LOVs for Creates reusable LOV components for the module
Module Components defined components included in your context object
within the module

You can select combinations of the boxes. If you select the use and reuse boxes, the
utility checks for suitable LOV components within the module and then for reusable
LOVs that have been defined but are not included in the module.

.....................................................................................................................................................
7-12 Oracle Designer 6i: Web PL/SQL Design and Generation
Adding a List of Values to a Module
.....................................................................................................................................................

How Does the Utility Work?

Module component One enterable, displayed item

A_MC

# RE_RNT_FK RTL_ID
#
* RTL_ID
LINE_NO
RTL_LOV
*
* RTL_PERIOD RTL_DATE
*
Lookup usage
LOV LOV
association component

RTL_LOV
LOV
A_MC.RTL_ID RTL_ID
inclusion
RTL_DATE

7-12

What Does the Default LOV Utility Require?


• The module component must have a table lookup usage.
• At least one item in the table lookup usage, or the foreign key item in the base
table, must be enterable and displayed.

What Does the Default LOV Utility Create? It creates an associated LOV
component for each lookup table usage. The LOV component has the following
characteristics:
• It is named using the naming convention <table alias>_LOV.
• It includes all the lookup table items in the module component.
• It is associated with the first LOV item in the module component that is enterable
and displayed.

.....................................................................................................................................................
7-13
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Creating an LOV Manually


You can use the module data view diagram to create a new LOV for a module. Once
you have created the LOV component you can include it in a module and associate it
with module items.

Associating an LOV with an Item

RTL_LOV
<Unassociated>
RTL_ID
A_MC.RTL_ID RTL_DATE

RIM.LINE_NO
RIM.RTL_PERIOD
RIM.RTL_ID

Association Associated Item RIM.RTL_ID

7-13

To create an LOV component, click one of the LOV buttons in the toolbar of the
module diagram data view:

Button Description
Include Reusable This button invokes a dialog in which you can select a reusable LOV or
List of Values a specific LOV you have already defined for the module.
Create Specific This button invokes the List of Values Data Wizard to step you through
List of Values the LOV component creation, selecting the table and column usages
required.

In the dialogs, you can specify the table usage, whether the generated LOV is to be
used for query or data entry, add additional query conditions, and modify the return list
mappings. When you create a specific LOV component or include a reusable LOV
component in a module, an inclusion is automatically created. A reusable LOV
component can have inclusions across different modules.
If you create an LOV outside of any module component, it is not associated with an
item. An LOV inclusion is created with the name <Unassociated>.
To associate an LOV component with an item, select the LOV then click the item.

.....................................................................................................................................................
7-14 Oracle Designer 6i: Web PL/SQL Design and Generation
Refining a List of Values
.....................................................................................................................................................

Refining a List of Values


You can edit an LOV to update its properties or to create or amend an association with
an item. The Web PL/SQL Generator ignores any information entered into the Size
and Placement tabs of the Edit List of Values dialog box.
Class
Editing an LOV Management
See Page 40
Edit List of Values RTL_LOV in HOLLYWOOD
Name Size Placement Usage Return List Additional Restriction Advanced

The List of Values can be used for different operations and can be
associated with an item within a module component. These options can
be set here.

Used For
Query and Data Entry Filter Before Display?
Query
Query and Data Entry
Data Entry
RIM.LINE_NO
RIM.RTL_PERIOD
RIM.RTL_ID

Associated Item RIM.RTL_ID Remove Association

Title Override

Cancel Help < Back Next > Apply Finish

7-14

Using the LOV for Data Entry or Query


You can specify the operations for which an associated LOV is used in the Usage tab
of the Edit LOV dialog:
• Query
• Data Entry
• Query and Data Entry

If you specify that a module component uses different LOVs for query and data entry,
the generator creates code to call the appropriate LOV. Alternatively, you can write
application logic to call a particular LOV under certain circumstances.

Entering Query Criteria for the LOV


In the Usage tab of the Edit LOV dialog, select the Filter Before Display? property to
specify that the user can enter a criterion to restrict the rows returned in the LOV.

.....................................................................................................................................................
7-15
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Creating the Return List

Mapping the Return List


Default
• LOV attached to FK
• LOV base table = FK table

Return List
Manual
• Map module
component item
RE.RTL_ID = LOV.ID
to LOV item

Module Component List of Values

7-15

The return list defines how the items in the module component map to the LOV items.
If the LOV is attached to the foreign key item in the base table and the base table of the
LOV component is a lookup table usage of that foreign key, the generator matches the
items.
If the generator is unable to create a mapping, it issues a warning. For example, the
generator cannot create a mapping when the domain table is attached to an unbound
item.
You can create the return list manually through the Edit List of Values dialog box
association properties as illustrated above. You can select a module component item
from the drop-down list and link it directly to an LOV item.

.....................................................................................................................................................
7-16 Oracle Designer 6i: Web PL/SQL Design and Generation
Refining a List of Values
.....................................................................................................................................................

Restricting the Records Displayed in an LOV


The data display in an LOV can be restricted by a WHERE clause. You can specify a
WHERE clause in a number of places:
• The lookup table usage of the module component
• The LOV component base table or lookup table usage
• The Additional Restriction clause of the LOV association
Class
Restricting the Values in the LOV Management
See Page 40

Lookup
table
usage

LOV
Specific component
association

7-16

If you add a WHERE clause to the lookup table usage of the module component, it also
restricts the records displayed in the LOV component. If you add a WHERE clause to an
LOV component base table or lookup table usage, it is incorporated into every LOV
association created from the LOV component.

Adding a Specific Restriction to an LOV Association


You can use the Additional Restriction tab of the Edit LOV dialog box specifically to
restrict the records displayed in the LOV. If you do this, the generator does not apply
the WHERE clause of the lookup table usage to the LOV. Also, the restriction only
applies to the use of the LOV in this specific item association.
By default, the additional restriction clause is added to the WHERE clause of the LOV’s
SQL statement. The generator may choose to add it to one of the other clauses. You
can also specify the use of the restriction in the Restriction Clause property.

.....................................................................................................................................................
7-17
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Example WHERE Clause Combinations

Example 1: The module component lookup table usage has a query WHERE clause.
The LOV component and association have no additional restrictions.
MC WHERE clause: CUS_ID IN (10,20,30)
LOV WHERE clause: <none>
Additional restriction: <none>
The module component WHERE clause applies in query mode and the LOV is
unrestricted when not in query mode.
Resultant WHERE clause on LOV (in query mode): CUS_ID IN (10,20,30)
Resultant WHERE clause on LOV (not in query mode): <none>

Example 2: The module component lookup table usage and the LOV component
each have a query WHERE clause. The LOV association has no additional restrictions.
MC WHERE clause: CUS_ID IN (10,20,30)
LOV WHERE clause: CUS_ID IN (10,30)
Additional restriction: <none>
The module component WHERE clause applies in query mode and the LOV is
unrestricted when not in query mode.
Resultant WHERE clause on LOV (in query mode): CUS_ID IN (10,30)
Resultant WHERE clause on LOV (not in query mode): <none>

Example 3: The module component lookup table usage and the LOV component
each have a query WHERE clause. The LOV association has no additional restrictions.
MC WHERE clause: CUS_ID IN (10,20,30)
LOV WHERE clause: CUS_ID IN (10,30)
Additional restriction: CUS_ID IN (30,40)
The module component WHERE clause applies in query mode and the LOV is
unrestricted when not in query mode.
Resultant WHERE clause on LOV (in query mode): CUS_ID IN (30,40)
Resultant WHERE clause on LOV (not in query mode): CUS_ID IN (30,40)
.

.....................................................................................................................................................
7-18 Oracle Designer 6i: Web PL/SQL Design and Generation
Controlling the Display of Lists of Values
.....................................................................................................................................................

Controlling the Display of Lists of Values


You can influence the generation of an LOV by setting preferences.
Class
LOV Preferences Management
See Page 41
Generator Preferences: Module - REN0010 (HOLLYWOOD)
Product PL/SQL Web Generator

Preference Set

Filter

List Of Values
List Of Values: Hyperlink htf.img(‘/images/button.gif’)
List Of Values: Caption for Close B
List Of Values: Caption for Find Bu
List Of Values: Frame Width 200
List Of Values: Style Invoke List Of Values In Own Window
List Of Values: Window Properties scrollbars=yes,resizable=yes,width=400,hei
Master Context
Option - Context
Popup Calendar

7-18

Hyperlink You can define the style of the hyperlink that invokes the LOV. You can
use the HTF functions to format text or to display an image (such as a button). When
the user presses the button code is generated to call the LOV.

LOV Button Captions You can specify the captions on the Close and Find buttons
inside the LOV window.

Style You can specify whether the LOV should appear in its own window or in a
specific frame.

Frame Width If the LOV is displayed in a frame, this preference defines the size of
the frame.

Window Properties You can control vertical and horizontal sizes of the displayed
LOV and whether it can be resized and scrolled.

.....................................................................................................................................................
7-19
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Updating and Inserting Multiple Records


Normally, a view form displays only the record that you select from the record list; this
is the only record that you can update. Similarly, on an insert form, you can enter only
one record at a time. You can choose to generate multirow insert and view forms,
which enable the user to enter, update, or delete several rows on one form before
saving the information.

How to Create a Form for Multi-Row Updates and Deletes


Class
Multiple Record DML Management
See Page 41

Mark for deletion

7-20

1 Set the layout of the module component to either Form or List/Form.


If you are using the List/Form layout style and want to see a record list as well
as a multirow view form, set the ZONLMV – Record List: Generate with
multi-row View Form preference.
2 Select the update and delete operations for the module component and its items.
3 Set the Rows Displayed property to a number greater than 1.
4 Set the ZONVTC – View Form: Number of items per line preference to
control the number of items that the generator places next to each other. You can
manipulate the display widths of the items to ensure that lines do not wrap.
5 When you delete records, the number of deleted items is shown at the top of the
multi-row view form. Set the ZONVSD – Show context items for deleted
rows preference to see a summary of the deleted items as well.
If there are more records than will display on a page, you can navigate to the next set
of records (using the generated buttons). If you navigate before sending your changes
to the repository, you are prompted to save or cancel the changes.

.....................................................................................................................................................
7-20 Oracle Designer 6i: Web PL/SQL Design and Generation
Updating and Inserting Multiple Records
.....................................................................................................................................................

Creating a Form for Multiple Row Inserts


The generator generates a separate page to handle inserts. You can thus control the
layout and style of the multirow insert form separately from the view form.

Multiple Row Inserts

ZONITC

ZONIBR

ZONIRC

ZONIIC SYSIMG

7-21

Ensure the module component allows insert. Set the following preferences to control
the layout of the Insert Form:

Preference Description
ZONIBR Specify the number of blank rows that appear in the form
ZONITC Specify the number of items that appear on each line
ZONIIC Define the prompt for the Insert button
ZONIRC Define the prompt for the Clear button

At the end of each row the generated Web page displays a check mark or blank, to
indicate whether or not that row will be inserted when you select Insert. A check mark
appears when you start to enter a row. It disappears if you select Clear for that row.
After entering new rows, you press the Insert button. You then see a page, which
contains:
• The number of rows that were successfully created
• A list of error messages for rows that were not created. The rows are also displayed
so that you can edit the data and resubmit it.
• Blank rows for more data entry

.....................................................................................................................................................
7-21
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Controlling User Input


You can use allowable values, LOVs, and pop-up calendars to control user input.
Using these methods, you can ensure that users enter only valid values.
A column in the repository may have an association with a set of valid values,
implemented as allowable values against the column or a domain. When you refer to
that column in a module, you can use this information to ensure that users cannot enter
invalid data in the column. You can also provide a list of allowable values for a custom
unbound item.

Setting a Default Value


You may find it useful to provide users with appropriate default values. If a default
value is set for a column, it is automatically used for all items based on that column.
You can also set default values for items in a specific module. If you set the default
value property for a bound item, the insert and view forms show it initially. You can
also use JavaScript to populate a field with an appropriate default value.

Creating GUI Display Items

Using GUI Display Types

Audio: 0RQR

Radio group 6WHUHR


6XUURXQG
6RXQG Meaning

Monochrome:
Check box

Classification: 3*
3*
Poplist 


Value

7-22

You can use a GUI display type for an item that has a set of allowable values.
1 Open the property palette for the item.
2 Set the Display Type property of a bound item to radio group, check box, poplist
or text list.
3 Set the Show Meaning property to the appropriate value.
If an item is optional, the generator automatically creates an additional value,
Unknown.

.....................................................................................................................................................
7-22 Oracle Designer 6i: Web PL/SQL Design and Generation
Controlling User Input
.....................................................................................................................................................

GUI Display Items and Foreign Key LOVs

Displaying Foreign Keys as GUI Items

• Poplist on foreign key column

Manager Identifier: 






• Poplist on lookup column

Manager’s Name: (15,*+7


9$/(17,12
(15,*+7
:,/'(0$11

7-23

You can display a foreign key column in a pop-up list or a text list. It is most useful
when:
• There are few referenced values
• The meaning of the referenced value is clear
• Your browser does not support JavaScript
To display your foreign key column as a GUI List of Values follow these steps:
1 Invoke the property dialog for the lookup item.
2 Select it for display.
3 Set the Query, Insert, and Update properties.
4 Set the display type to poplist or text list.

Technical Note
The GUI display type must be set on the lookup item, not on the base table foreign key
item. You do not display the foreign key item.

.....................................................................................................................................................
7-23
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Using Pop-Up Calendars

Pop-Up Calendars

7-24

The Web PL/SQL Generator automatically creates a hyperlink to the right of date
items. When a user clicks the hyperlink, a calendar displays in a pop-up window.
When the user clicks on a date, the calendar window closes and displays the date in the
field.
Without the pop-up calendar, the user must enter the date value in a specific format
otherwise it is not accepted as a valid date. With the calendar, the date is automatically
displayed in the correct format.
The hyperlink is controlled by the CALBUT – Popup Calendar: Hyperlink
preference. The default value for this preference is htf.italic(‘CAL’). By changing
the value of this preference, you can change the format of the hyperlink for the pop-up
calendar. To remove the calendar link, set the preference to NULL.
You can also use the following preferences to change the layout of the calendar
window:

Preference Description
CALCBC – Caption Defines an alternative caption for the button which closes the
for Close button pop-up calendar without the user selecting a date.
CALWIN – Window Defines the properties of the pop-up calendar window: size,
properties whether the window is scrollable, resizable or has toolbars.
The default value is scrollbars=no, resizable=no, width=320,
height=350.

.....................................................................................................................................................
7-24 Oracle Designer 6i: Web PL/SQL Design and Generation
Summary
.....................................................................................................................................................

Summary

Summary

• Detail record list placement


• Master–detail navigation
• Master context information
• Multiple record DML
• Lists of values and pop-up calendars
• GUI display items

7-25

Master–Detail Modules
Modules with master–detail layouts can have the detail record list on the same page as
the master view form or on a separate page. You can also use a hyperlink to move from
the master record list directly to the detail.

Master Context
Master context information makes it easier for the user to understand the context of the
detail information.

Lists of Values and Popup Calendars


Lists of values and pop-up calendars make it easier for the user to enter data.

Allowable Values
You can display allowable values using GUI display items:
• Radio groups
• Check boxes (do not appear on Query Form)
• Poplists and text lists.
Use a GUI display item for foreign key lookup columns when there are few, distinct
values.

.....................................................................................................................................................
7-25
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Practice 7—1: Examining a Master–Detail Module


Goal
The purpose of this practice is for you to look at the structure of a master–detail
module that was created by the ADT.

Scenario
You created the module REN0010 — Review/book a video by running the
ADT and then adding lookup table usages. Before you modify it into a useful set of
pages, you examine it to see what needs to be changed.

Your Assignment
Use the information below as your starting point:

Workarea Continue using the same workarea if you


have completed all practices or switch to
rescue workarea ORA<nn>_Les07_stp
Module REN0010 - Review/Book a Video

where <nn> is the group number that your instructor has assigned to you.
1 Generate, install, and run REN0010.
a The first page to appear is the Rentals query form. Enter 10005 as the
Membership Identifier and execute the query.
b What would make the record list more useful to the customer?
c Is there any information here that the customer should not see?
2 Select rental 5015.
a How can you find out which items were rented?
b What changes would make this more usable for the customer?
c Prevent the customer seeing information related to specific employees.

.....................................................................................................................................................
7-26 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 7—2: Reducing Pages in a Master–Detail Module
.....................................................................................................................................................

Practice 7—2: Reducing Pages in a Master–Detail Module


Goal
The purpose of this practice is for you to improve the presentation of data in a master–
detail module.

Scenario
You created the module REN0010 — Review/book a video by running the
ADT. Now you must modify it into a set of pages that enable customers to review
easily the items that they have rented. One of the issues is that there are too many
pages for the customer to move through. You reduce those pages in the following
ways:
• Add context information to the record lists.
• Place the detail record list on the same page as the master view form.
• Enable the user to navigate directly from the master record list to the detail record
list.

Your Assignment
Use the information below as your starting point:

Module REN0010 - Review/Book a Video

1 Make the changes identified in Practice 7—1.


The Record List should look like this:

a Add a chained lookup table usage to the RENTALS module component so that
customers can see their names (rather than their membership number).

.....................................................................................................................................................
7-27
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Add context items to the RENTALS module component so that customers can
b
see their names, rental dates, and rental numbers on the record list. Ensure that
the names are in the first item group.
c Add a chained lookup table usage to the RENTAL_ITEMS module component
so that the customer can see detailed information about the title.
d Add context items to the RENTAL_ITEMS module component so that the
customer can see the line number, price, period, and title on the record list.
e Generate, install, and run module REN0010. Check that the customer cannot
see the employee information.
2 Ensure that the Rental Items information appears on the Rentals view form.
a Make all items on the RENTAL_ITEMS module component nonqueryable.
b Generate, install, and run module REN0010. Navigate to the Rentals view
form. Is the Rental Items record list visible?
c What is the advantage of having the detail record list on the same page as the
master view form?
d Under what circumstances might you opt to have the detail record list on a
separate page?
3 Enable navigation directly to the detail record list from the master record list.
a Find out which generator preference you must alter.
b Set the preference for the RENTALS module component.
c Generate, install, and run module REN0010. What difference do you notice
on the record list of the master component?
d What would you expect to see if module REN0010 had two detail module
components?

.....................................................................................................................................................
7-28 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 7—3: Adding Contextual Information
.....................................................................................................................................................

Practice 7—3: Adding Contextual Information


Goal
The purpose of this practice is for you to investigate the ways of showing information
about the master record to put the detail records in context.

Scenario
The detail record pages of REN0010 — Review/book a video would be more
useful to the customer if they showed the information from the master record. You add
this information to the detail record list as a simple line and to the insert page in a more
complex fashion.

Your Assignment
Use the information below as your starting point:

Module REN0010 - Review/Book a Video

1 Set the appropriate Master Context preference to make the information available.
2 Set the Top of Record List user text for the RENTAL_ITEMS module component.
Refer to one or more of the master context items by item name.
3 Generate, install, and run module REN0010. You should be able to see your user
text string when you navigate to the Rental Items record list.
4 Click the New button to see the Insert page. Why does the context information not
appear here?
5 Specify that master context information should be displayed by a display package.
a Set the appropriate Master Context preference to the name of the package
(WSGMC_OUTPUT2).
b Set the appropriate Master Context preference to suppress the use of the
package on the Record List.
6 Generate, install, and run module REN0010. Navigate to the Rental Items insert
page. You should see the Rentals context items at the top of the page with an arrow
showing the link to Rental Items.

.....................................................................................................................................................
7-29
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Practice 7—4: Adding Lists of Values


Goal
The purpose of this practice is for you to add Lists of Values to a module.

Scenario
Currently, if they want to create new records in the module, users must know
information such as the membership identifier. You must implement suitable Lists of
Values to make the data entry process easier.

Your Assignment
Use the information below as your starting point:

Module REN0010 - Review/Book a Video

1 Run the Default Lists of Values utility for the REN0010 module.
a What LOV components are created?
b With which items are the LOV components associated?
2 Generate, install and run the module.
a Click a name in the record list to see the Rentals view form. Why can you not
see an LOV link here?
b Click the New button. Click the LOV link for the Membership number to see
the list of customers. Notice that the list shows organizations as well as
individuals.
3 Add a validation where clause to restrict the MBP_LOV to showing only
individual customers.
4 The list of titles in the CPY_LOV component could be very long. Enable the
customer to enter a condition that reduces the number of titles returned. Generate,
install, and run the module.
a Navigate to the Rental Items record list. Click the New button.
b Click the LOV link. Enter S% as the search criterion for Title.
c Click OK. Do you only see titles starting with S?
5 What problem do you see with this list of titles? Why does it occur?
6 Add a restriction to the association for the CPY_LOV component to ensure that
only available titles are returned.
7 Ensure that each title is returned only once:
a Add an SQL Aggregate unbound item called FIRST_COPY that returns the
minimum copy id.
b Remove all items from the L_CPY table usage.

.....................................................................................................................................................
7-30 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 7—4: Adding Lists of Values
.....................................................................................................................................................

Change the return list on the association to return values into the copy id, the
c
rental period, the price and the title.
8 Use the generator preferences to invoke the LOV from a button rather than a
hyperlink. (The lov.gif file in your directory contains a suitable image.)
9 Generate, install, and run the module.

.....................................................................................................................................................
7-31
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Practice 7—5: Creating Multiple Row Insert Pages


Goal
The purpose of this practice is for you to create and use a multirow insert form to
enable the user to create several records using a single commit.

Scenario
A current frustration with the Web pages is that users must insert and commit each
rental item separately. The developers have decided that you should create a multiple
record insert form for rental items.

Your Assignment
Use the information below as your starting point:

Module REN0010 - Review/Book a Video

1 Modify the RENTAL_ITEMS module component as follows:


aEnsure that it allows insert.
b Specify the number of blank rows on the insert form as 4.
c Set the number of items per line to 8.
d Generate and install the module.
2 Invoke the module and select a Rental record.
3 Click the New button for Rental Items to navigate to the insert form:
a How many records are displayed on the insert form?
b Enter some data into the first record. Notice the check mark that appears in the
Insert? column.
c Enter data for two new records. Click the Insert button.

.....................................................................................................................................................
7-32 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 7—6: Using Default Values and Calendars
.....................................................................................................................................................

Practice 7—6: Using Default Values and Calendars


Goal
The purpose of this practice is for you to investigate ways to validate and assist the
entry of data by users.

Scenario
When an employee records a rental for a customer, the employee’s identifier is
inserted into the record. In the Web application, there is no employee involved,
however the column is mandatory and you must insert a valid value.
A calendar link is automatically generated for all date items in a Web PL/SQL module.
You investigate how the usability of the application is affected without it.

Your Assignment
Use the information below as your starting point:

Module REN0010 - Review/Book Rentals

Setting Default Values for Items


1 Run the module to investigate what happens when you try to insert a new rental
record.
a On the startup page, click the New button.
b Use the LOV button to select a member.
c Use the CAL link to select a date.
d What happens when you click the Insert button?
2 Set up an appropriate default employee identifier for a new rental.
a In SQL*Plus, look at the EMPLOYEES table and identify the dummy employee
that is to be used for rentals made on the Web.
b Set the default value property for the EPE_IDENTIFIER item on the RENTALS
module component.
3 Generate, install, and run the module. You cannot see the change (the
EPE_IDENTIFIER item is not displayed) but can you now insert a record?

Investigating Pop-Up Calendars


4 In the Design Editor, turn off the pop-up calendar for this module.
5 Generate, install and run the module. Navigate to the insert form.
a Can you see the link for the pop-up calendar item?
b Type the date into the field with the month in numbers.
c What happens when you click the Insert button?

.....................................................................................................................................................
7-33
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

6 Use the generator preferences to invoke the calendar from a button rather than a
hyperlink. (The cal.gif file in your directory contains a suitable image.)
7 Generate, install and run the module. Navigate to the insert form to see your
changes.

.....................................................................................................................................................
7-34 Oracle Designer 6i: Web PL/SQL Design and Generation
Hints
.....................................................................................................................................................

Hints
Practice 7—1
There are no hints for this practice.

Practice 7—2
To perform this task Follow these steps
To add a chained 1 In the module diagram, click Create Table Usages.
lookup table usage 2 Click to the right of the initial lookup usage.
3 In the dialog, select the lookup table.
4 Select the required columns.
5 Click Finish.
To specify context 1 In the Navigator, select the items.
items 2 Invoke the Property Palette.
3 Set the Context? property to Yes.
To make items 1 In the Navigator, select the items.
nonqueryable 2 Invoke the Property Palette.
3 Set the Query? property to No.
To allow navigation 1 Open the Web PL/SQL Generator Preferences Navigator.
from a master record 2 Alter preference ZONLDL – Record List: Add
list directly to a detail hyperlinks to Record List to Yes.
record list

Practice 7—3
To perform this task Follow these steps
To make master 1 Open the Web PL/SQL Generator Preferences Navigator.
context information 2 Set the MCNMDP – Master Context: Maintain
available context to this depth preference to the appropriate
value.
To use a display 1 Open the Web PL/SQL Generator Preferences Navigator.
package to display 2 Set the MCNDPK – Master Context: Display package
master context preference to the name of the display package.
information
To specify the pages 1 Open the Web PL/SQL Generator Preferences Navigator.
on which to display 2 Set the MCNFRM – Master Context: Forms requiring
master context context preference to the appropriate value.
information

.....................................................................................................................................................
7-35
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Practice 7—4
To do this task Follow these steps
To run the Default 1 Select the module.
Lists of Values utility 2 Select Utilities—>Default Lists of Values from the menu.
To enable entry of a 1 Select the LOV association.
condition to an LOV 2 Invoke the Properties Palette.
3 Click the Usage tab.
4 Select Filter Before Display?.
To restrict the rows 1 Select the LOV association.
returned in an LOV 2 Invoke the Properties Palette.
3 Click the Additional Restriction tab.
4 Enter a condition.
To use a button to 1 Open the Web PL/SQL Generator Preferences Navigator.
invoke an LOV 2 Set the LOVBUT – List Of Values: Hyperlink
preference to call the HTF.IMG function with the appropriate
parameters.

Practice 7—5
To do this task Follow these steps
To specify the 1 Open the Web PL/SQL Generator Preferences Navigator.
number of blank rows 2 Set the ZONIBR preference to the appropriate number.
on the insert form
To specify the 1 Open the Web PL/SQL Generator Preferences Navigator.
number of items per 2 Set the ZONITC preference to the appropriate number.
line

Practice 7—6
To perform this task Follow these steps
To set a default value 1 Select the item in the navigator or diagram.
for an item 2 Open the property dialog.
3 On the Definition tab, enter the default value.
4 Click the Finish button.
To switch off the pop- 1 Open the Web PL/SQL Generator Preferences Navigator.
up calendar 2 Set the CALBUT – Popup Calendar: Hyperlink
preference to NULL.
To use a button to 1 Open the Web PL/SQL Generator Preferences Navigator.
invoke a calendar 2 Set the CALBUT – Popup Calendar: Hyperlink
preference to call the HTF.IMG function with the appropriate
parameters.

.....................................................................................................................................................
7-36 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Instructor Notes

Schedule

77 Timing Topic
B u ild in g M ore C om p lex M o du les 60 minutes Lesson
60 minutes Practice
120 minutes Total

Class Management
O verview
In this lesson you discuss master–detail


H o w d o I b u ild a m aster–d etail m o d u le?
H o w d o I p ro vid e d ata en try h elp to th e u s er?
modules. The lesson starts with a practice.
• C an I in sert an d u p d ate m u ltip le reco rd s?
• H o w d o I co n tro l w h at a u ser e nters?
• C an I u se a c alen d ar to p op u la te a d ate ite m ? Practice 7—1
The students run the “raw” master–detail
module that the ADT created in lesson 4 so
7-2
that they can get a feel for the problem.
Class Management
M aster–D etail L ayou t
M aste r You could do this section on the board. Draw
• R eco rd L ist:
– M aster
the module for people and their rentals. Draw a
– D e tail
diagram to illustrate the rental details on a
• D etail R eco rd L ist:
– O n sep arate p ag e separate page and on the same page. The
– O n m aste r V iew F orm
following two slides do the same.
D etail
7-4

Class Management
D etail o n S ep arate P age
P age heade r If the detail module component can be queried,
T itle
V iew form you do not have a choice about the placement
D etail hyperlink

P age footer
of the Record List—it is on a separate page.
P age header
T itle
1 Talk about the display, windows, and so on.
R ecord list
2 Discuss the different pages.
P age footer

7-5
3 Point out the hypertext links.

Demo
Using the display view, place the two module components in separate windows.
Your Les07 work area contains a version of the module (PAGE_RL) with the
components in separate windows. Show the generated version of this module
(page$.startup).

.....................................................................................................................................................
7-37
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Demo
D etail on S am e Pag e
P age header
Your Les07 work area contains a version of the
M aster Title
V iew form
module (MASTER_RL.*) with the detail record
list on the master view form.
R e cord list

Show the generated version of this module


D etail
P age footer (master$.startup).
D eta il m odule com ponent canno t be queried

7-6

Class Management
M aster–D etail N avigatio n
Title Links to D etail
Draw a master with two details on the board, to
H elp R ecord List
illustrate the module structure that would
C ol 1 C ol 2 C ol 3 D E TA IL D E TA IL

2001 xxx xxx C opies B ook


produce a page such as this.
2002 xxx xxx C opies B ook
Link to xxx xxx
V iew form 2102 C opies B ook

First P revio us N ext R eQ uery C ount


S et preference
Q uery N ew
ZO N L D L

7-7

Class Management
D isplayin g M aster C on text

W ork G roup 20
C lient S ide G enerators
O racle D esigner
TV P
Em p loyees PS E
12-M ar-1990
G riffith s
R equests
Requester’s
Com m ent::
Start D ate:
End D ate: to:
Half D ay:

Find C lear N ew

7-8

Class Management
L O V S tru ctu res
M odule com po nent LO V com ponent

LO V
association

LO V
inclusion

7-9

.....................................................................................................................................................
7-38 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Class Management
LO V Inclusio ns
• A re asso ciated w ith u p to o n e bo u n d o r u n bo u nd
Unassociated inclusions are important to

item
M ay b e u sed for Q u ery a n d D ata E n try
ensure that an LOV is not deleted by accident:


C an h a ve an A d d itio n al R estrictio n claus e
C an h a ve a retu rn list
when you delete the last association, the LOV
<U nassociate d>
R TL_LO V is also deleted.
R TL_ID
A _M C .R TL_ID R TL_D A TE

O n e LO V can have m an y in clusio n s in a m o d ule.

7-10

Class Management
U sing th e D efault L O V U tility
U tilities G ene rate
G roup Item s...
R em ove From G roup...

R esequence...
D efault Lis t O f V alues U tility
C opy O bject... C on text objec t for w hich Lists o f V alues w ill b e created
C opy W ith new Language M o dule R E N 0010 (W G _H O LLY W O O D )
Force D elete...
M ap U nbound Item s á U se R e usa ble Lists of V alu es
T o u se R eus able L ists of Va lu es from o uts id e th e co ntain er of the
co ntex t o bjec t, s pe cify the se arch p ath in th e A dd itio na l C o nta iners
D efault Links… field b elow .
Ad ditiona l
D efault Lists of Values... Co ntaine rs
B ro w se...

Validate
á R eus e existin g Lists o f V alues defined w ithin th e m o du le.

á C rea te R e usa ble Lis ts o f V a lues fo r R eu s able M od u le C o m p one n ts.


C rea te R e usa ble Lis ts o f V a lues fo r M od ule C om po ne nts de fine d
w ith in the m o du le.

S tart C anc el H elp

7-11

Class Management
H o w D o es the U tility W o rk?

M odule com po nent O ne enterable, display ed item

A _M C

# R E _R N T_FK R T L_ID
#
* R T L_ID R T L_LO V
*
* LIN E _N O R T L_D A TE
* R T L_P E R IO D
Look up usage
LOV LO V
a ssociation com ponent

R TL_LO V
LO V
A _M C .R TL_ID R T L_ID
inclusion
R T L_D A TE

7-12

Class Management
A ssociating an L O V w ith an Item

R TL_LO V
<U nassocia ted>
R TL_ID
A _M C .R TL _ID R TL_D A TE

R IM .L IN E_N O
R IM .R TL_P E R IO D
R IM .R TL_ID

A sso ciation A ssociated Item R IM .R TL _ID

7-13

.....................................................................................................................................................
7-39
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Class Management
Ed iting an L O V
E dit L ist of V alues R TL_LO V in H O LLY W O O D
Demonstrate the changes that you can make in
N am e S ize P lace m ent U sage R eturn L ist A dditional R estriction

The List of V alues can be used for d ifferent o perations a nd can be


A dvanced

asso ciated w ith an item w ithin a m o du le com po nent. The se o ptio ns can
the Edit LOV dialog.
be set h ere.

U sed F or
Q ue ry and D ata E ntry F ilte r B efo re D is p lay?
Q ue ry
Q ue ry and D ata E ntry
Data E ntry
R IM .LIN E _N O
R IM .RT L_P E R IO D
R IM .RT L_ID

A ssociated Item RIM .R T L_ID R em o ve A s soc iatio n

T itle O verrid e

C anc el H elp < B ac k N ext > A pp ly Fin is h

7-14

Class Management
M app in g the R eturn L ist
D e fau lt
• L O V attach ed to F K
• L O V base tab le = F K ta b le

R eturn L ist
M an u al
• M ap m o du le
com p o nen t item
R E .R T L _ID = L O V .ID
to L O V item

M o d ule C o m p o n en t L ist o f V alu es

7-15

Class Management
R estrictin g th e V alues in the L O V
The following slide is not reproduced in the
L o o ku p
student notes. Instead, there is a page showing
tab le
u sag e the cumulative effect of WHERE clauses.
LOV
S p e cific co m po n en t
asso ciatio n

7-16

This slide uses builds to show the effect of


H ow are W H E R E C lau ses A p plied? multiple WHERE clauses with LOVs.
Q uery
W HERE
cus_id
• L oo ku p tab le u sag e (10,20,3 0)

• L O V com p o nen t
cus_id (10,30)
• S p ec ific a ssociatio n
(30,40)

WH
WHER
ER EE (( (:
(
(:SYS
:SYS
SYSTTE
EM.M
M.MOD
M.MO
ODDE
E == ‘‘E
‘EN
ENTER
NTER
TER--QQUER
UERY’
UERY
Y’’)
)
AAND
ND ((C
CUS_
US_ID
US_I
IDD IN
I N ((10
10,2
,30)
0,3) 0)
0))
OR
OR (AND
(NOT
NOT (C
:SYS
: US_ID
SYST
TEEM.
M.MOD
INMOD(E10,3
E == ‘E
0))
‘ EN
NTER
TER-
-QQUE
UERY’
RY’))
OR (NOT
--no
--n o :res
SYSTE
rest
trric
ictio
M. MODE
tionsns = ‘ EN TER-Q UE RY’ )
)) --n o restr ic tion s
A ND CUS_
) ID IN (30 ,40 )
7-17

.....................................................................................................................................................
7-40 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Class Management
LO V Preferen ces
Demonstrate the use of the preferences.
G enerator P refere nces: M odu le - R EN 0010 (H O L LY W O O D )
P rod uct P L/S Q L W eb G enerato r

P referen ce S et

Filter

L ist O f V alues
L ist O f V alue s: Hyperlin k h tf.im g(‘/im ages/bu tto n.g if’)
L ist O f V alue s: Caption for C lo se B
L ist O f V alue s: Caption for F ind B u
L ist O f V alue s: Fram e W id th 200
L ist O f V alue s: S tyle Invoke List O f V alues In O w n W indow
L ist O f V alue s: W in dow P rop erties scro llb ars=yes,resizab le=yes,w id th=400,hei
M aster Co ntext
O ptio n - C ontext
P o pu p C alenda r

7-18

Class Management
M ultip le R ecord D M L
Stress that the update and delete page is
separate from the insert page. As such, the
properties are dealt with separately.

M ark for deletio n

7-20

Class Management
M ultip le R ow Inserts

Z O N ITC

ZO N IB R

ZO N IR C

ZO N IIC S Y S IM G

7-21

Class Management
U sing G U I D isplay Types

A ud io: 0 RQR
R adio g roup 6WHUHR
6XUURXQG
6RXQG M ea ning

M onochrom e:
C heck box

C lassification: 3*
3*
P oplist 


V alue

7-22

.....................................................................................................................................................
7-41
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Class Management
D isplaying F oreign K eys as G U I Item s

• P o plist on fo reign key co lu m n

M anager Ide ntifier: 






• P o plist on lo o ku p co lum n

M anager’s N am e: (1 5 ,* + 7
9$ /(1 7,1 2
(15 ,* + 7
: ,/'(0 $ 1 1

7-23

Class Management
Po p-U p C alend ars

7-24

Class Management
S um m ary

• D etail reco rd list p lacem en t


• M aster– d etail navig ation
• M aster co n te xt info rm ation
• M u ltip le reco rd D M L
• L ists of valu es an d p op -u p calend ars
• G U I disp lay item s

7-25

Practices
If the students get a runtime error that refers to WSGL.LayoutData, ensure that the
NO_OF_RENTALS unbound item is in the same item group as MBP_IDENTIFIER.

Practice 7—3 The students the CG_INTO.GIF file for the arrow image used by the
display package.

Practice 7—4 If the Default Lists of Values utility cannot find a suitable bound
item, ensure that MBP_IDENTIFIER and CPY_ID are enterable and displayed.
Calls to the HTF.IMG function can specify various parameters:
htf.img (file, alignment, alt_text, image_map, html_attributes)

.....................................................................................................................................................
7-42 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Post Lesson Teaching Evaluation
.....................................................................................................................................................

Instructor Post Lesson Teaching Evaluation


Name: Full Email:

Course Name: Oracle Designer 6i: Web PL/SQL Design and Generation
Lesson number: 7
Number of teaches before filling this form: 1 - 2 - 3 to 5 - >5

Global comments: (circle all that apply)


• Lesson content: Trivial - Too easy - OK - Difficult - Too difficult
• Slide content: Too many slides - Too few slides - O.K
• Text content.Too much text - Not enough text - Unclear - O.K.
• Practice content: Too difficult - Too easy - Problems - O.K.

Detail comments
Content type: Slide - Text - Practice - Instructor notes
Note: 1:needs animation - 2:too much animation - 3:needs more text - 4:too much text
- 5:Unclear - 6:not necessary - 7:Other

Content Page
Note Comments/Suggestions
Type Number

Photocopy this page and fax to: Oracle Designer Curriculum Development @ +(44) 118.924.5181
Additional sheets are available at the end of the instructor’s guide.
If you draw additional diagrams on the white board use the Graphic sheet in the Instructor Evaluation
section at the end of this book.

.....................................................................................................................................................
7-43
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

.....................................................................................................................................................
7-44 Oracle Designer 6i: Web PL/SQL Design and Generation
Suggested Graphics
.....................................................................................................................................................

Suggested Graphics
Instructor name: Full email:

Course Name:Oracle Designer 6i: Web PL/SQL Design and Generation


Lesson No: 7 Page No:
Please sketch your additional diagram below.

.....................................................................................................................................................
7-45
®
Lesson 7: Building More Complex Modules
.....................................................................................................................................................

Oracle Designer Education Products


Curriculum Development
520 Oracle Parkway
Thames Valley Park
Reading - Berkshire
England

fold here

.....................................................................................................................................................
7-46 Oracle Designer 6i: Web PL/SQL Design and Generation
8
.................................

Defining Application Logic


in the Repository
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Introduction
You can add more functionality to your modules by defining application logic, in the
form of event code segments or named routines. In this lesson, you learn about
defining application logic and how to choose whether to implement your application
logic as PL/SQL on the server or as JavaScript in the client browser.
You also learn how to define unbound items and how to use Java applets in
Web PL/SQL modules.
Schedule
Overview See Page 34

• What is application logic?


• What languages should I use?
• How do I create application logic?
• How do I display custom items?
• Can I use Java applets?

8-2

Topic See Page


Introduction 2
Understanding Application Logic 4
Events 6
Defining an Event Code Segment 11
Using the Logic Editor 12
Named Routines 14
Defining Custom Items 17
Deriving a Value from an SQL Expression 18
Deriving a Value from a Function 20
Embedding Java in a Web PL/SQL Application 22
Summary 27
Practice 8—1: Adding Client-Side Event Code 28

.....................................................................................................................................................
8-2 Oracle Designer 6i: Web PL/SQL Design and Generation
Introduction
.....................................................................................................................................................

Topic See Page


Practice 8—2: Adding Server-Side Named Routines and Events 30
Practice 8—3: Populating an Unbound Item 31

Objectives
At the end of this lesson you should be able to do the following:
• Enforce business rules on the client using JavaScript.
• Enforce business rules on the server using PL/SQL.
• Populate unbound items.
• Use a Java applet in a Web PL/SQL module.

.....................................................................................................................................................
®

8-3
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Understanding Application Logic


Application logic is code created by the generator and any additional code you enter to
extend the functionality of your generated applications. Application logic in a Web
application can be:
• Executed in the client (JavaScript) or on the server (PL/SQL).
• An event or a named routine.
Class
Types of Application Logic Management
See Page 34
Application Logic

About this Slide


See Page 34

Library Generated User User

Browser:
http:// Modified Event Code
WSGL Generator
Event Code
Named
Routines

8-4

Library application logic This comprises the Web PL/SQL Generator library,
which you installed in the application user account or a library account before
generating your modules. This code is not held in the repository.

Generated application logic This comprises the event code segments and named
routines created by the Web PL/SQL Generator. They are not held in the repository;
they are PL/SQL packages installed in the application user database account. If a
module is generated again, the existing code is overwritten.

Modified generated application logic This comprises event code segments,


normally created by the generator, that you have replaced with your own code. This is
only recommended for experienced developers.

User application logic This comprises event code segments and named routines
that you define in the repository. You can add application logic to modules, module
components and items using the Design Editor.
This lesson discusses user application logic.

.....................................................................................................................................................
8-4 Oracle Designer 6i: Web PL/SQL Design and Generation
Understanding Application Logic
.....................................................................................................................................................

PL/SQL or JavaScript?
About this Slide
What Languages Can I Use? See Page 35

Module

PL/SQL TITLES
8 SUPPLIERS

Module
Component
Browser:
http://
COPIES PRICE
JavaScript LEVEL
Hollywood

Item

8-5

PL/SQL runs on the server, in the database. You should use it when you need to access
data in the database or use the facilities of PL/SQL. You may not write application
logic at the item level in PL/SQL.
JavaScript runs in the client browser and gives access to a series of native routines that
provide, for example, alert messages and confirmation request dialog boxes. If the
browser running the generated Web PL/SQL application does not support JavaScript,
you cannot access these features. As it runs in the client, JavaScript gives an
immediate response. You should use it to carry out processing that should take place
before querying the database or before attempting to insert, update, or delete records.
You may not write application logic at the module level in JavaScript.

Network Considerations
If you execute application logic on the server, you increase network traffic. Because
server-side event code involves a network call, it cannot respond immediately to user
entry.
If you execute application logic in the client, you reduce network traffic but increase
the amount of processing which the client carries out. As client-side event code is
embedded in the HTML page, response is immediate.

.....................................................................................................................................................
®

8-5
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Events
Events automatically fire at a particular point during processing. You can define
PL/SQL event code to run on the server and JavaScript event code to run in the client.
Demo
What Is an Event? See Page 35

8 PL/SQL PreInsert
curr_val.return_date :=
sysdate + curr_val.rental_period;

Browser:
http:// Event Code
JavaScript OnClick
Hollywood

window.open(“http://www.oracle.com”)

8-6

What Is an Event Code Segment?


An event code segment can be a standalone section of JavaScript or PL/SQL but
typically it is a call to a JavaScript or PL/SQL named routine.
Within an event code segment you can access any native function and procedure of the
language you are using, call any named routine defined within the repository, and call
functions and procedures created by the Web PL/SQL Generator.
Note: Server-side event code segments can also call procedures and functions stored
on the server that are not part of the module (system-wide subprograms).

Executing Events
The module executes item-level events first, then module component-level events, and
finally module-level events.

.....................................................................................................................................................
8-6 Oracle Designer 6i: Web PL/SQL Design and Generation
Events
.....................................................................................................................................................

Server-Side Events
Events are not native to the PL/SQL language but the generator creates a pseudo-event
in the package body for each module component.
About this Slide
PL/SQL Events See Page 35

Module Component Module


Level Level

PreQuery PostQuery Public declarations


PreInsert PostInsert Private declarations
PreUpdate PostUpdate Pragma declarations
PreDelete PostDelete
ServerValidate

8-7

Pseudo PL/SQL Events Each pseudo-event is a procedure or function stub that acts
as a placeholder. When you define a PL/SQL event in the repository, the generator
adds your event code segment to the appropriate PL/SQL pseudo event. The generator
recognizes the following server-side pseudo-events at the module component level:

Event Type When the event is called


PreQuery Before a query is executed
PostQuery After you select the current row
PreInsert Before you insert a record into the database
PostInsert After you insert a record into the database
PreUpdate Before updating a record on the database
PostUpdate After updating a record on the database
PreDelete Before you delete a record from the database
PostDelete After you delete a record from the database
ServerValidate Before an insert or an update

With the exception of ServerValidate, these event types are private.


Within your PL/SQL code you can call any of the Toolkit or WSGL functions and
procedures, custom functions and procedures, or named routines.

.....................................................................................................................................................
®

8-7
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Declarations In addition to defining events, you can also declare variables,


constants, cursors, and user-defined datatypes at either module or module component
level.
• Private declarations are added to the module or module component package body
and the declared items are only available to procedures and functions in the same
package.
• Public declarations are added to the module or module component package
specification and the declared items are available to procedures and functions in
other packages.
• Pragma declarations restrict references added to the module or module component
package body.

Using Custom PL/SQL Packages If your Web PL/SQL application has


functionality or formatting requirements that you cannot fulfil using the Toolkit
packages or WSGL, you can define PL/SQL packages that return valid HTML and
create the special effects you require.
1 Install the custom packages in either the application user account or the Toolkit
library account.
2 Add the names of the packages to the PKGLST preference.
3 Embed calls to the procedures and functions in the packages within the module
design, for example, in user text, titles and headings, page headers and footers,
hyperlinks to the About Page, and bullet symbols.

.....................................................................................................................................................
8-8 Oracle Designer 6i: Web PL/SQL Design and Generation
Events
.....................................................................................................................................................

Client-Side Events
Events are native to the JavaScript language. The generator adds the JavaScript event
code to a PL/SQL procedure in the module component package body, using functions
and procedures from the Toolkit and WSGL.
About this Slide
JavaScript Events See Page 35

Item Action item Module component

OnBlur OnMouseOut Validate


OnChange OnMouseOver OnLoad
OnClick OnUnload
OnFocus
OnSelect

8-8

JavaScript Events The JavaScript language defines a number of events for each
screen item. Whenever a particular event occurs in relation to a particular item, the
browser executes any JavaScript defined for that event.

Repository Event When the event occurs


Element Type
Item OnBlur A selected area, text field, or text area loses focus
OnChange A selected area, text field, or text area element is modified
OnClick An object such as a button or check box is clicked
OnFocus A selected area, text field or text area receives focus (the
user tabs to it or clicks it with the mouse)
OnSelect Some or all of the text in a text field or text area is selected
Action OnMouseOut The hint text is cleared when the mouse moves out of the
Item hotspot
OnMouseOver The hint text is displayed when the mouse moves over the
hotspot

.....................................................................................................................................................
®

8-9
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Repository Event When the event occurs


Element Type
Module Validate Before submitting an insert or update form
Component OnLoad An insert or update form finishes loading
OnUnload An insert or update form unloads before displaying another
form

Within your code you can call native JavaScript functions and procedures, custom
named routines, or functions and procedures in the JavaScript library (WSGJSL).

Location of JavaScript Code The Target Location defines the procedure in which
your JavaScript event code segment appears and the page on which the event executes.
Any code added to the view form is also added to the insert form. However, you can
use a JavaScript variable (FormType) to distinguish the insert and view forms if you
require.

Page Target Location PL/SQL Procedure FormType Variable


Record List Record List CreateListJavaScript List
View Form Insert/View Form CreateViewJavaScript Update
CreateInsertJavaScript
Insert Form Insert/View Form CreateViewJavaScript Insert
CreateInsertJavaScript
Query Form Query Form CreateQueryJavaScript Query

If you want a piece of code to execute when the value of a particular item changes, you
add the code segment to that item’s OnChange event and define the Target Location as
View/Insert Form. When the user changes the value of the item, the browser executes
the OnChange event and your application logic takes effect (along with any generated
application logic for that event).

.....................................................................................................................................................
8-10 Oracle Designer 6i: Web PL/SQL Design and Generation
Defining an Event Code Segment
.....................................................................................................................................................

Defining an Event Code Segment


You can define custom event code against modules, module components and items in a
Web PL/SQL module. You can also define the sequence of the new code in relation to
other code that is generated for the same event.
.

About this Slide


Defining an Event Code Segment See Page 36
1. Use the Events branch.
2. Select the event.
3. Name the code segment.
4. Sequence the code segment.
You can add user code and override event code
segments
Name User code to check Manager ID
User code to check Manager ID
Client-Side Data Validation
Client-Side Check Constraint Validation

5. Add logic using the Logic Editor.

8-9

1 In the Navigator, select the Application Logic node for the appropriate element
(module, module component or item).
2 Select the Events node.
3 Click Create.
4 Select the event to which you want to add code and click Next. (You only see
events that are applicable to the selected element.)
5 Enter a Name for the event code segment.
6 Use the Up and Down arrows to define the sequence of the custom code. You can
place your event code segment amongst other code segments for the same event.
7 For a client-side event, use the Target Location property to define the HTML
document in which the generator adds the event code.
You can define different actions on each generated page—query form, record list,
view form, and insert form—for any one item.
8 Click Next and then select Create the definition and open the Logic Editor.
The Logic Editor window and a construct tree for the appropriate language
(PL/SQL or JavaScript) appear.
9 Enter the code for the selected event using the Logic Editor.

.....................................................................................................................................................
®

8-11
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Using the Logic Editor


You use the Logic Editor to add code to a segment.
About this Slide
Using the Logic Editor See Page 36
• Event code segments
Demo
• Named routines
See Page 36
PL/SQL Logic check_mgr_id
BEGIN
PL/SQL
….
END;

JavaScript Logic check_mgr_id

if (FormType == “Update”) JavaScript


{
….
}

8-10

How to Invoke the Logic Editor


1 In the Navigator, select the repository definition for which you want to define
logic.
2 Either:
– Click on the main toolbar.
Or:
– Click on the right mouse button to display a pop-up menu and choose the Edit
Logic/Edit PL/SQL option.
If a Logic Editor window is already open, a new Logic Editor session starts. The Logic
Editor has two components:
• The construct tree window
• The code window

The Construct Tree Window


The Construct Tree Window shows a read-only list of syntactically correct
programming constructs for the appropriate programming language (PL/SQL or
JavaScript). You can copy these into the Code Window.

.....................................................................................................................................................
8-12 Oracle Designer 6i: Web PL/SQL Design and Generation
Using the Logic Editor
.....................................................................................................................................................

The Code Window


The code window has a text editor where you enter your code. This is achieved by
dragging and dropping constructs into the editor or by typing directly into the editor.
The editor also provides the following options:
• Keyword substitution: The editor converts keywords that you type into the
appropriate format for the specific language and color codes them.
• Automatic indentation: The Logic Editor indents text that you type to the same
level as the previous line.
• Text formatting: The Logic Editor automatically formats the text you enter,
indenting nested constructs, removing blank lines and wrapping text.
• Syntax checking: The Check Syntax utility checks the syntax of PL/SQL code.
• Customizable keyboard mappings: You can add and remove keystrokes.
• Keystroke macros: You can record a series of keystrokes and play them back by
assigning them to a key. You can record up to ten macros.
You can enable or disable any of these options.
If you have the code in an external file or you would like to record the contents of an
event code segment or routine in an external file, you can use the Import Text/Export
Text utility from the Edit menu.

.....................................................................................................................................................
®

8-13
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Named Routines
A named routine is any complete procedure or function that you include in a module.
Named routines do not execute automatically; you call them from event code
segments. Typically, multiple events call the same named routine to avoid duplicating
code in each event.
About this
Looking at Named Routines Slide
See Page 36
PL/SQL PROCEDURE
check_mgr_id IS

Events
Named Routines

check_mgr_id

function check_mgr_id {

JavaScript }

• Must be called by an event


• Avoid duplicating event code
• Define using the Logic Editor

8-11

In generated applications, server-side named routines are written in PL/SQL and


executed on the server; client-side named routines are written in JavaScript and
executed in the client browser.
Server-side event code can only call server-side named routines and client-side event
code can only call client-side named routines.

.....................................................................................................................................................
8-14 Oracle Designer 6i: Web PL/SQL Design and Generation
Named Routines
.....................................................................................................................................................

Defining a Named Routine


About this Slide
Defining a Named Routine See Page 36

Create Application Logic: Named Routine ? x Practice


The details required for a named routine include the name, type,
target location and scope. You may also choose to exclude the
See Page 36
routine from generation
Name
Check_Mgr_ID
Type of routine
Target Procedure
Target Location Language
View/Insert Form JavaScript

Target Location Language


View/Insert Form PL/SQL

No Target

8-13

1 In the Navigator, select the Application Logic node for the appropriate element
(module component or module).
2 Select the Named Routines node.
3 Click Create.
4 Enter a Name for the routine.
5 For a client-side named routine:
a Set the Language of the routine to JavaScript.
b Enter the Target Location. This information is used in the same way for both
event code and named routines.
For a server-side named routine:
a Set the Language of the routine to PL/SQL.
b Choose whether it is Public or Private.
If you make a named routine public, its declaration appears in the package
specification and its implementation in the package body. If you declare it as
private, both its declaration and its implementation appear in the package body.
Procedures and functions outside the package can call public named routines.
Only procedures and functions in the same package can call a private named
routine.
6 Click Next and then select Create the definition and open the Logic Editor.
The Logic Editor window and a construct tree for the appropriate language
(PL/SQL or JavaScript) appear.
7 Enter the code for the selected event using the Logic Editor.

.....................................................................................................................................................
®

8-15
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Server-Side Named Routines


The generator always adds the body of the named routine to the package body for the
object to which the named routine belongs (the module component or the module). If
the named routine requires default values, you should include them in its parameter
list.
You do not have to write the declaration for a server-side named routine. The Web
PL/SQL Generator derives the declaration from the procedure or function and
automatically adds it to the package specification (for a public named routine) or the
package body (for a private named routine).

.....................................................................................................................................................
8-16 Oracle Designer 6i: Web PL/SQL Design and Generation
Defining Custom Items
.....................................................................................................................................................

Defining Custom Items


You can develop your application further by defining custom items.

About this
Defining Custom Items Slide
See Page 37
Rental Window
Rentals

Unbound
item
Custom...

Action items Navigation...

Link to...

Hyperlink text or
image
8-14

Action Items
Action items in Web PL/SQL applications are used to:
• Navigate to a specific module or module component.
• Execute code defined for an event.
Action items can be displayed as buttons, hyperlink text or hyperlink images. They are
discussed further in the last lesson.

Unbound Items
Unbound items can be used to record the an item whose value cannot be derived from
a single column.
The Web PL/SQL Generator supports unbound items that derive their values from:
• An SQL expression
• A server-side function
• A client-side function
The Web PL/SQL Generator also supports custom unbound items, which execute user-
defined code on an event.

.....................................................................................................................................................
®

8-17
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Deriving a Value from an SQL Expression


An SQL Expression unbound item generates an HTML element that derives its value
from an SQL expression.

About this Slide


SQL Expression Derivation See Page 37

Unbound Item Properties Demo


See Page 37
Name TOTAL_PRICE
Unbound Type SQL Expression

SQL
Derivation Text round .....

calculate...

round (price + (price * (17.5/100)),2)

8-15

The Derivation Text property defines the calculation that provides the value. A derived
value appears in the unbound item when the module queries the database. The
unbound item appears as read-only text. If a value within the derivation expression
changes, the module can calculate the new value either on the client or the server.

Client-Side Derivation
If the Web PL/SQL Generator can translate the SQL expression to JavaScript and the
client browser supports JavaScript, you can calculate derived values within the
browser. This enables you to calculate and display dynamically the derived value
during data entry (before the record is submitted to the server). A JavaScript
OnChange event recalculates and displays the new value of the derived field
whenever a value within the derivation expression changes.
Values are derived in the browser if the following conditions hold:
• All SQL functions, keywords and operators that you use in the derivation
expression are supported by the generator.
Note: The generator cannot convert SQL date functions to JavaScript.
• All items that you reference within the SQL expression appear on the HTML
document where you require the dynamic calculation.
• The ZONVEC – Derive Expressions In Client preference is set to
Yes.

.....................................................................................................................................................
8-18 Oracle Designer 6i: Web PL/SQL Design and Generation
Deriving a Value from an SQL Expression
.....................................................................................................................................................

Server-Side Derivation
If the browser does not support JavaScript or an SQL function, keyword, or operator
that you use within the SQL Expression is not supported by the Web PL/SQL
Generator, the derivation expression calculations can only take place on the server.
This means that you only see changes to derived fields after you refresh a record.

.....................................................................................................................................................
®

8-19
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Deriving a Value from a Function


Server-side and client-side function unbound items generate HTML elements that
derive their value from PL/SQL and JavaScript functions.

Server-Side Function Unbound Items

About this Slide


Server-Side Derivation See Page 37

Unbound Item Properties

Name TOTAL_PRICE
Unbound Type Server Side Function

SQL
Derivation Text htf.hr(...

calculate...

htf.hr(cattributes=>‘WIDTH = 500’)

8-16

The Derivation Text property specifies the name of the PL/SQL function and its
parameters. The derivation calculation can only take place on the server, so you only
see changes to derived fields after you refresh a record. You can use custom PL/SQL
functions or procedures that you defined in the repository as named routines to
populate values for a server-side function unbound item. You can also use any other
PL/SQL function or procedure that the application can access.

Example The Web PL/SQL Generator can only use item groups on the record list.
However, you can use a server-side unbound item to place horizontal lines on other
pages and partition them into functional areas.
Create a server-side unbound item, LINE1, and set the Derivation Text as:
htf.hr(cattributes=>’WIDTH = 500’)
This calls the HR Toolkit function and tells it to draw a line that is 500 pixels wide.
You can use the Display Sequence property of the unbound item LINE1 to place the
horizontal line exactly where you want it. If you create several unbound items and
populate them in this way, you can divide your page into horizontal blocks.

.....................................................................................................................................................
8-20 Oracle Designer 6i: Web PL/SQL Design and Generation
Deriving a Value from a Function
.....................................................................................................................................................

Client-Side Function Unbound Items


The Derivation Text property specifies the name of the JavaScript function and its
parameters.
About this Slide
Client-Side Derivation See Page 37

Unbound Item Properties

Name TOTAL_PRICE
Unbound Type Client Side Function

SQL
Derivation Text calculate...

calculate...

calculate_client_price ()

8-17

The JavaScript function calculates the derived value dynamically during data entry.
You can set the OnChange events for each value within the function to recalculate the
derived item if that value changes. You can use custom JavaScript functions that you
defined in the repository as named routines to populate values for client-side function
unbound items.

Example You could write a JavaScript function calculate_client_price()


to calculate the total price including tax.

Custom Unbound Items


A custom unbound item provides you with the ability to create an item totally under
your control. It may be a text field, a GUI widget (if you define allowable values
against it), or a button. You must then define either a client-side or a server-side event
to specify how the item is used or populated.

.....................................................................................................................................................
®

8-21
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Embedding Java in a Web PL/SQL Application


Sun Microsystems describes Java as:
“A simple, object-oriented, distributed, interpreted, robust, secure, architecture-
neutral, portable, high-performance, multithreaded, and dynamic language.”
About this Slide
Using Java See Page 38
• Java - object-oriented language developed by Sun
MicroSystems
• Applet - small, embeddable Java program
• Browser must be able to interpret Java
• Call applet:
– Embedded <APPLET> tags in HTML
– From custom PL/SQL procedure

8-18

An applet is a Java application that runs in a Web page. There is a wide variety of
applets available, so you can often find an applet that fulfills a specific need and that
you can plug in as a reusable object.
There are two ways in which you can run Java applets in a Web PL/SQL application:
• Embed the <APPLET> tag in the user text areas of the generated pages.
• Write a custom PL/SQL function that returns the appropriate HTML for the applet.
You can call the function from
– The user text areas of the generated pages.
– The derivation text of an unbound item.

.....................................................................................................................................................
8-22 Oracle Designer 6i: Web PL/SQL Design and Generation
Embedding Java in a Web PL/SQL Application
.....................................................................................................................................................

Calling an Applet Directly from User Text


About this Slide
Calling an Applet See Page 38
• Add HTML to User Text
• Pass arguments using the <PARAM> tag

User text

Text Location User Text


Default Area*
Top of View <APPLET CODE =
myPackage.ShowMyApplet()
Form* myApplet.class WIDTH=200
HEIGHT=100>
</APPLET>
<PARAM NAME=PARAM1
VALUE=“XXXX”>
</APPLET>

• Call a custom PL/SQL function

8-19

You can call an applet by embedding the HTML <APPLET> tag in any of the areas in
which you can place user help text. You can place an applet at the module level on the
startup or about pages.
You can place a module component level applet on the record list, view form, query
form or insert form. The applet can only appear where user text appears.
If you place an applet on the record list, the applet starts when you navigate to that
page. If you leave the record list page or the applet scrolls off the screen, the applet
stops. It resumes when the applet becomes visible once mo
re.

The <APPLET> Tag


In the <APPLET> tag, you must specify the name of the applet and the height and
width of the space that it occupies on the Web page:

<APPLET CODE=myApplet.class WIDTH=500


HEIGHT=100>
</APPLET>

The above code tells the browser to execute an applet called myApplet.class in
an area of 500 by 100 pixels.
In the absence of other information, the browser assumes that it can find the applet in
the same directory as the current document. You can specify the location of the applet
using the CODEBASE attribute.

.....................................................................................................................................................
®

8-23
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

The CODEBASE attribute can be an absolute URL or a relative one, which the
browser interprets as relative to the URL of the current document. Using an absolute
URL, the browser can load an applet from a different HTTP server.

<APPLET CODEBASE=URL CODE=myApplet.class WIDTH=500


HEIGHT=100>
</APPLET>

You can pass parameters to an applet by using the <PARAM> tag. The exact
parameters that you can set depend on the applet’s code. Applets use a method called
getParameter() to read the <PARAM> tag and extract the information.

<APPLET CODEBASE=URL CODE=myApplet.class WIDTH=500


HEIGHT=100>
<PARAM NAME=parameter1 VALUE=value1>
<PARAM NAME=parameter2 VALUE=value2>
</APPLET>

.....................................................................................................................................................
8-24 Oracle Designer 6i: Web PL/SQL Design and Generation
Embedding Java in a Web PL/SQL Application
.....................................................................................................................................................

Calling an Applet from a Custom PL/SQL Function

Using a Custom PL/SQL Function

• Call a PL/SQL function from the Derivation Text of


an unbound item

REN070
Arguments
Module Components Server-side
function
EMP_MC
Table Usages
Unbound Items
abc SHOW_APPLET

DERIVATION TEXT:
myPackage.ShowMyApplet()

8-20

You can place a call to your custom PL/SQL function in the user text areas of any of
your generated pages. You must remember to include the name of the package which
contains your custom PL/SQL function in the PKGLST - PL/SQL Package
List preference.
In order to use an unbound item to display an applet, you must add a call to your
custom PL/SQL function in the Derivation Text of the unbound item. The advantage
of this approach is that you can place an applet anywhere on a generated page using
the Display Sequence property of the unbound item. In addition, if you want to change
the applet, you need only change the PL/SQL function. You do not have to re-generate
the module.

.....................................................................................................................................................
®

8-25
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Writing a Custom PL/SQL Function


Your function should return a text string which contains the appropriate combination
of HTML tags to call an applet and pass it any necessary parameters.

function ShowMyApplet (the_text VARCHAR2)


RETURN VARCHAR2 is

r_string VARCHAR2(2000);

BEGIN
r_string := htf.appletopen(’myAppletText.class’,250,
60, ’CODEBASE=/java/’);
r_string := r_string || htf.param(’paraA’,the_text);
r_string := r_string || htf.appletclose;

return r_string;
END;

The example above creates the HTML to call an applet called myApplet.class
from a virtual directory /java/.
If you place the following function call in the derivation text of an unbound item:

ShowMyApplet(“this is a string”)

The HTF functions appletopen, param, and appletclose are called in


turn to return the following HTML code:

<APPLET CODEBASE=”/java/” CODE=myAppletText.class


WIDTH=50 HEIGHT=60>
<PARAM NAME=paraA VALUE=“this is a string”>
</APPLET>

.....................................................................................................................................................
8-26 Oracle Designer 6i: Web PL/SQL Design and Generation
Summary
.....................................................................................................................................................

Summary

Summary

• Events and named routines


– Client-side using JavaScript
– Server-side using PL/SQL
• Unbound items
– SQL expressions
– Server-side functions
– Client-side functions
• Java applets
– User text or custom functions

8-21

Events and Named Routines


You can place user-defined application logic at module, module component and item
level. You can write either event code segments or named routines, to be executed on
the server or in the client. The following table summarizes your options:

Level Logic Type Languages


Module Event, named routine PL/SQL
Module Component Event, named routine PL/SQL, JavaScript
Item Event JavaScript

Unbound Items
• SQL expressions can be evaluated on the client if the generator supports the
conversion of SQL functions into JavaScript, otherwise they are evaluated in the
server.
• Server-side functions use PL/SQL named routines or any accessible
PL/SQL function or procedure.
• Client-side functions use JavaScript named routines.
• You can also use unbound items to display custom items.

Java Applets
You can embed Java applets in Web PL/SQL applications as user text or custom
functions.

.....................................................................................................................................................
®

8-27
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Practice 8—1: Adding Client-Side Event Code


Goal
The purpose of this practice is for you to use the Design Editor and Logic Editor to
define a client-side event.

Scenario
When a customer changes their personal details, they need to have the option to cancel
their changes at the point they save them to the database. You need to create an event
to display an alert allowing the customer to cancel the changes if necessary.

Your Assignment
Use the information below as your starting point:

Workarea Continue using the same workarea if you


have completed all practices or switch
to rescue workarea ORA<nn>_Les08_stp
Module MEM0010 - Maintain Personal Details

where <nn> is the group number that your instructor has assigned to you.
1 In the Navigator, create a client-side Validate event called Confirm_Changes
for the CUS_RMC reusable module component.
2 Use the Logic Editor to enter JavaScript code that displays an alert when the
customer clicks the Update button on the view form. Enter the code, as outlined in
the following sample, from the file les08_1.txt, in your working directory:
if (!confirm("Are you sure you want to save these changes?"))
{
alert("Update cancelled")
return false
}
else
{
alert("Processing Update...")
return true
}

3 Generate, install and run the module.


a Query a customer record and navigate to the view form.
b Change one of the field values and attempt to save the changes. Does the alert
display?

.....................................................................................................................................................
8-28 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 8—1: Adding Client-Side Event Code
.....................................................................................................................................................

c Click Cancel in the alert box. Are the changes saved?


d Click Update again.
e In the alert dialog, click OK. Are the changes saved?

.....................................................................................................................................................
®

8-29
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Practice 8—2: Adding Server-Side Named Routines and


Events
Goal
The purpose of this practice is for you to use the Design Editor and Logic Editor to
define a server-side named routine and call it from a server-side event.

Scenario
The return date for a rental item is derived by adding the rental period to today’s date.
You need to create an named routine to derive the return date and call the routine from
an event.

Your Assignment
Use the information below as your starting point:

Module REN0010 - Review/Book a Video

1 In the Navigator, create a PL/SQL named routine called Set_Return_Date for the
RENTAL_ITEMS module component.
2 Use the Logic Editor to enter PL/SQL code that derives the return date of a rented
item:
PROCEDURE Set_Return_Date IS
BEGIN
curr_val.return_date := sysdate + curr_val.rental_period;
END;

3 In the Navigator, create a server-side PreInsert event called Derive_Date for


the RENTAL_ITEMS module component.
4 Use the Logic Editor to enter code that calls the named routine.
5 Generate and install and run the module.
a Insert a new rental and save it by clicking on the Insert button.
b Insert a new rental item and save it.
c Is the return date derived correctly?

.....................................................................................................................................................
8-30 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 8—3: Populating an Unbound Item
.....................................................................................................................................................

Practice 8—3: Populating an Unbound Item


Goal
The purpose of this practice is for you to use the Design Editor and Logic Editor to
define an unbound item.

Scenario
Developers would like the customer name to appear as context information. You need
to create an unbound item to display the entire customer name as a single value.

Your Assignment
Use the information below as your starting point:

Module MEM0010 - Maintain Personal Details

1 On the CUS_RMC reusable module component, create a SQL Expression


unbound item called FULL_NAME that concatenates DESIGNATION,
FIRST_NAME and LAST_NAME (the result should be, for example, Dr Evelyne
Bachelet).
2 Make FULL_NAME a context item and display it before the photograph. Clear the
Context? property for FIRST_NAME and LAST_NAME.
3 Generate, install and run the module.
4 Query a customer and change part of the name. Do not click Update.
5 Has FULL_NAME been updated to reflect the change? If not, why not?
6 In the Design Editor and set the required preference in the GENERAL preference
set to derive expressions in the client.
7 Generate, install and run the MEM0010 module again.
8 Query a customer and change part of the name. Do not click Update.
9 Has FULL_NAME been updated to reflect the change? Why?
Note: The context header is only updated when the changes have been saved.

.....................................................................................................................................................
®

8-31
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Hints
Practice 8—1
To perform this task Follow these steps
To create a client-side 1 In the Navigator, select the object (module or reusable module
event component) to which you want to add the event.
2 Expand the Application Logic node and select Events.
3 Click Create.
4 Select the required event and click Next.
5 Click Add and enter a name for the event code segment.
6 Set the Target Location.
7 Set the Language to JavaScript.
8 Set the sequence of the event code segment.
9 Click Finish.
To add application 1 Select the event.
logic to an event 2 Select Edit—>Logic....
3 Enter the code.
4 Click the Save button.

Practice 8—2
To perform this task Follow these steps
To create a server- 1 Select the object to which you want to add the routine.
side named routine 2 Select Named Routines.
3 Click Create.
4 Enter a name for the routine.
5 Set the Language to PL/SQL and set the Scope.
6 Click Finish.
To add application 1 Select the Named Routines node.
logic to a named 2 Select Edit—>Logic....
routine 3 Enter the code.
4 Click the Save button.
To create a server- 1 In the Navigator, select the object (module or reusable module
side event component) to which you want to add the event.
2 Expand the Application Logic node and select Events.
3 Click Create.
4 Select the required event and click Next.
5 Click Add and enter a name for the event code segment.
6 Set the Language to PL/SQL and set the Scope.
7 Set the sequence of the event code segment.
8 Click Finish.

.....................................................................................................................................................
8-32 Oracle Designer 6i: Web PL/SQL Design and Generation
Hints
.....................................................................................................................................................

Practice 8—3
To perform this task Follow these steps
To create an unbound 1 In the Navigator, expand the required module component.
item 2 Select Unbound Items.
3 Click Create.
4 Specify details of the unbound item.
– Name
– Type
– Datatype
– Display properties
5 Click Finish.

.....................................................................................................................................................
®

8-33
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Instructor Notes
Schedule

88 Timing Topic
D efin ing A p plicatio n L o gic 45 minutes Lesson
in th e R epo sitory
30 minutes Practice
75 minutes Total

About this Slide


O verview

• W h at is app licatio n lo gic?


• W h at lan g uag es sh o u ld I use?
• H o w d o I crea te ap p lication lo g ic?
• H o w d o I d isp lay c u sto m item s?
• C an I u se Java app lets?

8-2

Class Management
W h at Is A pp lication Lo g ic?

SERVER
This slide is not in the manual.
P L /S Q L

8
C all N am ed
About this Slide
E vents
R outines
B row ser:
h ttp ://
Emphasize that both named routines and
H o lly w o o d
C LIE N T
JavaS cript
events can execute in the server and on the
client. The choice of location determines the
8-3
choice of language.
About this Slide
T ypes of A pp lication L og ic
A pplication Log ic
Generated application logic and library
application logic are not held in the repository.
Library G enerated U ser U ser The repository holds user application logic. We
B ro w se r:
are going to concentrate on the application
M odified
W SGL
h ttp://

G enerato r
E vent C od e
E vent C ode
logic that they create themselves, against
N am ed
R outines
modules, module components, and items.
8-4

For more advanced users, generated logic can


be replaced or modified with custom code. We
do not cover this in the lesson. Notice the
different icons used to represent user-defined
logic and user-modified generator logic.

.....................................................................................................................................................
8-34 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

About this Slide


W h at Lan gu ag es C an I U se?
Emphasize that though it is possible to create a
M odule
JavaScript function at module level, there is no
P L/S Q L TITLE S
8 S U P P LIE R S

M odule
place for it to execute. JavaScript functions
C om ponent
B row ser:
http://

Jav aS cript
C O PIE S PR IC E
LE V EL
must be part of an HTML page.
H o llyw o o d

Item

8-5

Demo
W h at Is an E vent?
Do a quick demonstration here to show how to
8 P re Insert
create an event on:
P L/S Q L
curr_val.re turn _date :=
sysdate + c urr_val.re ntal_period; • Module
B row ser:
http://
Jav aS cript O nC lick
E vent C od e
• Module component
H o llyw o o d

w indow .open(“http://w w w .oracle.co m ”)


• Item
8-6 Illustrate the different events that exist. Don’t
spend too much time on demonstrating the
Logic Editor.
About this Slide
PL /S Q L E ven ts
Remember to mention that a PL/SQL event
M odule C om ponent
Level
M odule
Level can call any existing PL/SQL function or
P reQ uery P ostQ uery P ublic declarations
procedure. The PL/SQL routines called by
P reInsert
P reU pda te
P ostInse rt
P ostU pdate
P rivate decla rations
P ragm a declarations events do not have to be named routines.
P reD elete P os tD e lete
S erverV a lidate

8-7

About this Slide


JavaS crip t E ven ts
Make sure that the class are aware that Java
Item A ction item M odule com pon ent
and JavaScript are totally separate.
O nB lur
O nC hang e
O n M ouseO ut
O n M ouseO ver
V alid ate
O nL oad
Remember to mention the WSGJSL package,
O nC lick
O nFocus
O nU nload
which contains a JavaScript equivalent for
O nS elec t
most SQL functions.
8-8

.....................................................................................................................................................
®

8-35
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

About this Slide


D efinin g an E ven t C o de S egm ent
1. U s e th e E ven ts b ra n ch.
If you want to place more than one segment of
2.
3.
S e lect the even t.
N a m e th e co d e seg m en t. code in an event, you can determine in which
4. S e qu en ce th e cod e seg m en t.
Y ou can add user code a nd override event code
segm ents
order they execute.
N am e U ser c ode to check M anage r ID
U ser code to check M anager ID
C lient-S id e D ata V alidation
Emphasize that this is just a reference to the
C lient-S id e C heck C ons traint V alida tion
code—it does not create the code itself.
5. A d d lo g ic u sing th e L o g ic E dito r.

8-9

About this Slide


U sing the L ogic E dito r
• E ven t co d e s egm en ts Remember that you can open the Logic Editor
• N am ed ro u tin es
P L/S Q L Logic check_m gr_ id
by dragging a named routine or event onto the
B E G IN
….
P L/S Q L work surface.
END;

JavaS cript Lo gic che ck_m gr_id

if (Form Type == “U pdate”) JavaS cript Demo


{

}
….
Demonstrate the use of the Logic Editor.
8-10

About this Slide


L ookin g at N am ed R ou tines
P L/S Q L PROCEDURE
Make sure that the class understand that named
check_m gr_id IS

E vents routines do not execute unless they are called


N am ed R o utines

ch eck_m gr_ id when an event occurs.


fu nction check _m gr_id {

JavaS cript }

• M ust b e called b y an even t


• A void du p licatin g even t co d e
• D efin e u sin g th e L o g ic E d ito r

8-11

About this Slide


D efinin g a N am ed R ou tin e
Point out that the Web PL/SQL Generator does
C reate A pplic ation Logic: N am ed R outine ? x
The de ta ils requ ired for a nam ed rou tine in clude th e nam e, ty pe,
ta rg et location and sc ope . You m ay also ch oose to exclude the
routine from gen eration
not use the Type of routine field. Named
N am e
C he ck_M gr_ID
Type of ro utine
routines should only be defined at Module or
Target P rocedure
Target Loc ation Lan guage Module component level.
V iew /Insert Form Jav aS cript

Target Loc ation


V iew /Insert Form
Lan guage
P L/S Q L
Emphasize that only JavaScript uses the target
N o T arget
location.
8-13

Practice
After discussing events and named routines, it
is a good idea to consolidate the lecture by
doing practice 8-1 and 8-2 before moving on to
defining custom items'.

.....................................................................................................................................................
8-36 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

About this Slide


D efinin g C u sto m Item s
We introduce Action Items in this lesson but
R e ntal W indow
R entals we do not discuss them so keep your
U n bound
explanation brief. Action Items are discussed
C ustom ...
item
further in the last lesson.
A ction item s N avigation...

Link to ...

H yperlin k text or
im a ge
8-14

About this Slide


SQ L Exp ression D erivatio n

U nbound Item P roperties


If the preferences have been set to derive SQL
N am e TO TA L_P R IC E
expressions in client, SQL expression unbound
U nbound T ype S Q L E xpression
items can be updated in the client if:
SQL
D erivatio n Text round ..... • The SQL expression can be converted to
calculate...

round (price + (price * (17.5 /100)),2 )


JavaScript.
• All the items from which the unbound item
8-15

is derived appear on the page.

Demo
Demonstrate how to create an unbound item
and set the Derivation Text property.
About this Slide
Server-Side D erivation

U nbound Item P roperties


Server-side functions can be used to display
N am e TO TA L_P R IC E
HTML, if you use the appropriate procedures
U nbound T ype S erver S ide Function
and functions from the Developer’s Toolkit.
SQL
D erivatio n Text htf.hr(...

calculate...

htf.hr(cattributes=> ‘W ID TH = 500’)

8-16

About this Slide


C lient-S ide D erivatio n

U nbound Item P roperties


Make sure that the class understands that the
N am e TO TA L_P R IC E
JavaScript function calculates the derived
U nbound T ype C lient S ide Function
value dynamically during data entry.
SQL
D erivatio n Text calculate...

calculate...

calcu late_client_price ()

8-17

.....................................................................................................................................................
®

8-37
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

About this Slide


U sing Java
• J ava - o b ject-o rien ted lan g uag e d evelop ed by S u n
The applet can be anywhere.
M icroS ystem s
• A p p let - sm a ll, em b ed d ab le Java p ro gram
• B row ser m u st b e a ble to interp ret Java
• C all ap p let:
– E m b ed d ed <A P P L E T > tag s in H T M L
– F ro m cu sto m P L /S Q L p ro ced ure

8-18

About this Slide


C alling an A p plet
• A d d H T M L to U ser T ext Emphasize that you can:
• P ass arg u m en ts u sing th e <P A R A M > tag

U ser text • Put the HTML to call the applet in the user
Text Location
DTop
efault
of VAiew
rea*
U ser Text
<A P Package
m yP LE T C O
.SDhow
E = M yA pplet()
text.
Form * m yA pplet.c lass W ID TH =2 00
H E IG H T=10 0>
</A
<P APRPALE
MT>N A M E =P A R A M 1
V A LU E =“X X X X ”>
• Use a call to a PL/SQL function that uses
</A P P LE T>
the Developer’s Toolkit to return the
• C all a cu sto m P L /S Q L fu n ctio n
appropriate HTML.
8-19

About this Slide


U sing a C usto m P L/S Q L F un ction

• C all a P L/S Q L fu n ction from th e D erivatio n T ext o f


an u n b o u nd item

R E N 070
A rg um ents
M odule C om ponents S erver-side
functio n
E M P _M C
Table U sages
U nbo und Item s
ab c S H O W _A P P LE T

D E R IV A TIO N TE X T :
m yP a ckage.S how M yA pple t()

8-20

About this Slide


S um m ary

• E ven ts an d n am ed rou tin es


– C lient-sid e u sing JavaS cript
– S e rver-sid e us in g P L /S Q L
• U n b o un d item s
– S Q L exp ressio ns
– S e rver-sid e fu n ction s
– C lient-sid e fu n ctio n s
• J ava ap p lets
– U s er text o r cu stom fu nction s

8-21

.....................................................................................................................................................
8-38 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Post Lesson Teaching Evaluation
.....................................................................................................................................................

Instructor Post Lesson Teaching Evaluation


Name: Full Email:

Course Name: Oracle Designer 6i: Web PL/SQL Design and Generation
Lesson number: 8
Number of teaches before filling this form: 1 - 2 - 3 to 5 - >5

Global comments: (circle all that apply)


• Lesson content: Trivial - Too easy - OK - Difficult - Too difficult
• Slide content: Too many slides - Too few slides - O.K
• Text content.Too much text - Not enough text - Unclear - O.K.
• Practice content: Too difficult - Too easy - Problems - O.K.

Detail comments
Content type: Slide - Text - Practice - Instructor notes
Note: 1:needs animation - 2:too much animation - 3:needs more text - 4:too much text
- 5:Unclear - 6:not necessary - 7:Other

Content Page
Note Comments/Suggestions
Type Number

Photocopy this page and fax to: Oracle Designer Curriculum Development @ +(44) 118.924.5181
Additional sheets are available at the end of the instructor’s guide.
If you draw additional diagrams on the white board use the Graphic sheet in the Instructor Evaluation
section at the end of this book.

.....................................................................................................................................................
®

8-39
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

.....................................................................................................................................................
8-40 Oracle Designer 6i: Web PL/SQL Design and Generation
Suggested Graphics
.....................................................................................................................................................

Suggested Graphics
Instructor name: Full email:

Course Name:Oracle Designer 6i: Web PL/SQL Design and Generation


Lesson No: 8 Page No:
Please sketch your additional diagram below.

.....................................................................................................................................................
®

8-41
Lesson 8: Defining Application Logic in the Repository
.....................................................................................................................................................

Oracle Designer Education Products


Curriculum Development
520 Oracle Parkway
Thames Valley Park
Reading - Berkshire
England

fold here

.....................................................................................................................................................
8-42 Oracle Designer 6i: Web PL/SQL Design and Generation
9
.................................

Security and Web PL/SQL


Applications
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

Introduction
The implementation of security is an important aspect of your generated application.
You can implement security in the Web server and in the generated application.
Schedule
Overview See Page 20

About this Slide


• Can I prevent the user accessing certain data? See Page 20
• Can I prevent the user accessing data out of
context?
• How does the server implement security?
• Can I implement security for a Web application?

9-2

Topic See Page


Introduction 2
Security Issues 3
Restricting Data Access 4
Approaches to Security in the Server 7
Implementing Security Using Packages 10
Summary 14
Practice 9—1: Arguments and Web PL/SQL Modules 16
Practice 9—2: Implementing Self-Service Security 18

Objectives
At the end of this lesson, you should be able to do the following:
• Explain the various approaches to security in the server
• Implement security in Web PL/SQL applications

.....................................................................................................................................................
9-2 Oracle Designer 6i: Web PL/SQL Design and Generation
Security Issues
.....................................................................................................................................................

Security Issues

Implementing Server Security

• Module arguments
• Web PL/SQL Generator:
– Prevent a call out of context
– Enforce case-insensitive URL
• Web server:
– Define valid usernames or domains
– Use DADs and PL/SQL Agents
– Set up secure directories
• Database:
– Define users, roles and profiles

9-3

There are a number of ways to handle security on the Web. Some of these exist
independently of the Web PL/SQL Generator and you have had the facility to
implement them for some while:
• Define arguments for modules
• Set Designer preferences
– Prevent pages being called out of context
– Ensure that URLs are not case-sensitive
• Use a Web server to control security
– Define users, sets of users, or groups such as IP addresses
– Protect virtual directories
– Use Database Access Descriptors and PL/SQL agents
• Control roles and privileges in the database
If you have no access to the Web server and want to protect the data displayed
on a Web page, you can protect it by controlling access to the data directly, using
roles and database privileges.
You can also implement security by using PL/SQL packages to control access before a
user invokes an application or modules within the application.

.....................................................................................................................................................
9-3
®
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

Restricting Data Access


You can restrict the records that a user can view by including an argument in the URL
that links to the module component.
About this Slide
Restricting Data Available to a Module See Page 20
REN070
Arguments
Technical Note
XY Z_POSITION See Page 20
Allowable Values
Argument Item Usages
abc POSITION
Module Components
http://webserver/agent/
employees$.startup?Z_POSITION=SALES
EMP_MC
Table Usages
Bound Items
Application Logic

• Create an argument
• Associate with a bound item
• Set the value in the URL

9-4

An argument restricts the records queried for the first module component. When
module arguments are defined, the call to the procedure is as follows:
<module>$.startup?Z_<col1>=<val1>&Z_<col2>=<val2>...
For example, if the user enters the following URL, the only record the user can see is
that for member number 9001:
http://MyServer/wg_dad/members$.startup?Z_ID=9001

Using Module Arguments


In order to use an argument in the call to a module, you must set the SECECS -
Enforce URL Checksums preference to No and define a module argument.
1 In the Navigator, select the module.
2 Expand the Arguments node and click Create.
3 Specify the name and datatype of the argument. The name must be the name of the
bound item prefixed by Z_. (The Web PL/SQL Generator uses no other properties.)
4 Save the argument.
5 Select the Argument Item Usages node and click Create.
6 Select the bound item, from the first module component, that you want to associate
with the argument. For Web PL/SQL modules, the operator is always ‘=’.

.....................................................................................................................................................
9-4 Oracle Designer 6i: Web PL/SQL Design and Generation
Restricting Data Access
.....................................................................................................................................................

Ensuring Applications Are Called in Context


The structure of the generated code addresses some security issues. The package
specifications contain declarations of public procedures and functions. The package
body contains private procedures and functions.
About the slide
Preventing Direct Call of a Page See Page 21

Browser:
http:// webserver/agent/emp$emp_mc.queryview

emp$emp_mc.queryview?Z_DIRECT_CALL=TRUE
emp$emp_mc.queryview

access denied

9-5

Some generated procedures (such as queryview, which creates the view form) are
public because other procedures need to access them. You should never call them
directly from a URL because they must only be called in the appropriate context.
These procedures have two arguments, Z_DIRECT_CALL and Z_CHK, that are set by the
calling procedure. Whenever these procedures are called, Z_DIRECT_CALL must be set
to TRUE and Z_CHK must contain a valid checksum value.
You cannot set the value of Z_DIRECT_CALL in the URL and so it is always FALSE.

.....................................................................................................................................................
9-5
®
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

About the slide


Using Checksums See Page 21

emp$emp_mc.queryview
?P_EMPNO=7844&Z_CHK=7128
?P_EMPNO=7845&Z_CHK=7128

Browser:
http://host:9999

emp$emp_mc.queryview
?P_EMPNO=7845&Z_CHK=7128

9-6

If the SECECS - Enforce URL Checksums preference is set to Yes, the procedure
checks that the value specified by Z_CHK is valid. If it is not, you are denied access to
the page.
This prevents users from querying records to which they have authorized access and
then modifying the URL to view unauthorized records.

.....................................................................................................................................................
9-6 Oracle Designer 6i: Web PL/SQL Design and Generation
Approaches to Security in the Server
.....................................................................................................................................................

Approaches to Security in the Server


There are two basic server approaches to application security: authentication or
restriction.
About this Slide
Server Authorization See Page 21

http:// Web Server

Listener

• Authentication
– Basic or digest

• Restriction
– IP addresses

– Domain names

9-7

Authentication

Basic Authentication The browser prompts the user for a username and password
when the user attempts to access a protected page or application. Valid usernames and
passwords are stored in an operating system file.
Unless you are using a secure communication channel such as Secure Sockets Layer
(SSL), there is no encryption on the username and password. Anyone capable of
intercepting HTTP traffic could obtain the username and password.

Digest Authentication This approach differs from basic authentication only in that
the password is encrypted. Some older browsers do not support digest authentication
and the listener does not encrypt the user password for them.

Database Authentication In this scheme, the usernames and passwords are stored
on a database. This simplifies administration as you only maintain only one set of
usernames and passwords for both Web and database access.

Using Authentication The Web server listener can use basic or digest
authentication. An authentication server validates requests for generated Web pages
and can use any of the authentication, including database authentication.

.....................................................................................................................................................
9-7
®
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

Restriction

IP Address Restriction The administrator can restrict access to specified IP


addresses. The hierarchical structure of IP addresses allows you to include or exclude
entire sub-trees or classes, for example:

IP address Effect
+130.* includes all addresses that start with 130
-138.3.164.* excludes all IP addresses that start with 138.3.164
+138.3.164.108 includes the specific address 138.3.164.108

Domain Restriction Similar to IP Address Restriction, the administrator can restrict


access on the basis of domain name. You can use wildcards in the domain name, for
example, *.xyz.com denies access to all clients in the xyz.com domain

Using Restriction Both the Web server listener and the authentication server can
use either of the restriction schemes.

.....................................................................................................................................................
9-8 Oracle Designer 6i: Web PL/SQL Design and Generation
Approaches to Security in the Server
.....................................................................................................................................................

Forcing Server Authentication


Within some Web servers, you can define protected virtual paths. If a user enters a
URL that contains a protected path, the browser asks for a valid username and
password.

Forcing Authentication
http://webserver/agent/emp$.startup

Security invoked

Browser:
http://host:9999

Protected path: agent/emp$*

Security evaded

http://webserver/agent/EMP$.startup

9-8

There is a potential loop-hole in this authentication mechanism because the virtual


path is case-sensitive. If the virtual path /<your_agent>/emp$* is protected, an
authentication dialog is launched when the URL exactly matches it:
http://<webserver>/<your_agent>/emp$.startup
If the user enters the following URL, no authentication takes place:
http://<webserver>/<your_agent>/EMP$.startup
In order to prevent unauthorized access in this way, set the SECEUC - Force
lower case URL preference to Yes. The Web PL/SQL Generator creates additional
code to force the URL to lowercase, so that authentication is invoked whenever a user
enters a protected URL.

.....................................................................................................................................................
9-9
®
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

Implementing Security Using Packages


Oracle Designer 6i provides two packages to help you generate Web PL/SQL
applications that use the Security API to provide a user with a logon screen.

Authorized Security
When you implement authorized security, you define a responsibility that has access to
the module and you associate users with the responsibility.
Demo
Authorized Security See Page 22
Browser:
http://
Known user
Rent a Movie
with access
Title
Category

Browser Logon Required


http://Username:
Browser
Password: Known user http://
with no access Access Denied
You do not have permission to
use this application

Logon

Enters URL
Unknown
Browser:
user http://
Invalid Logon

Error! AccessRequired
Logon denied

Username:

Password:

9-9

When a user attempts to access a module, a logon form pops up. The user enters a user
name and password and one of the following happens:
• If the entered username has access to the application, the first page is displayed.
• If the entered username does not have access to this application (but is known to
the system), then access is denied and the user can return to the logon form.
• If the entered username is unknown to the system, an error message is displayed.

.....................................................................................................................................................
9-10 Oracle Designer 6i: Web PL/SQL Design and Generation
Implementing Security Using Packages
.....................................................................................................................................................

Implementing Authorized Security


The shipped wsgsec.sql file builds a series of tables and a security package that you
can use to implement authorized security. You can modify the package to your own
requirements.

Implementing Authorized Security

• SECVAL, SECPKG and SECRES preferences


• Tables that store users and responsibilities
• Security package

USER PACKAGE
RESPONSIBILITY PERMISSIONS

USER RESPONSIBILITY

9-10

You must enter data into the tables to set up responsibilities, users and the relationship
between them. When the module is generated, the generator sets up the relationship
between responsibilities and packages.
You set the following preferences to implement authorized security for a specific user
module:

Preference Description
SECPKG – Security The name of the security package you are using
Package Name
SECRES – Default A list of the responsibilities that can access the module or module
Responsibilities component
SECVAL – Perform When set to Yes, a call is made before each page is displayed to
Session Validation ensure that the current user is allowed to use the module.

The supplied security package writes a cookie back to the browser, so the user only
needs to log on to the application once per session. You can write your own security
package to implement this type of security.

.....................................................................................................................................................
9-11
®
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

Self-Service Security
When you implement self-service security, any user can attempt to access the
application.
About this Slide
Self-Service Security See Page 23
Browser

http://

First time Register with Hollywood


Name
Address
Postcode

Date of Birth

Browser

http://
Subsequent Please sign in
accesses

User Register

Password

9-11

When a user attempts to access a module, a logon form pops up.


• If the user has accessed the form before, the user need only enter their username
and password and click the Logon button to access the module.
• If the user has not accessed the form before, the user must complete the personal
details requested on the form and click the Logon button. The details are saved to
the table and then the user can access the form.

.....................................................................................................................................................
9-12 Oracle Designer 6i: Web PL/SQL Design and Generation
Implementing Security Using Packages
.....................................................................................................................................................

Implementing Self-Service Security


The shipped wsgsr.sql file builds a series of tables and a security package that you
can modify or use to implement self-service security.

Implementing Self-Service Security

• SECVAL, SECPKG and SECRES preferences


• Table that stores user data
• Security package

USERDATA

9-12

By default, the security package asks the user for the following details: username,
password, title, name, sex, address, email address, telephone. You can customize this
to suit your own requirements.
You set the following preferences to implement self-service security for a specific user
module:

Preference Description
SECPKG – Security The name of the security package you are using
Package Name
SECVAL – Perform If you set this to Yes, before each page is displayed a call is
Session Validation made, to ensure that the current user is allowed to use the
module.

.....................................................................................................................................................
9-13
®
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

Summary

Summary

• Server authorization is based on domains or IP


addresses
• Web PL/SQL Generator Preferences help to
prevent breaches of security
• A Web PL/SQL application can implement
authorized or self-service security

9-13

Server Authorization Approaches


There are three authentication schemes available:
• Basic requires username and password
• Digest uses encrypted username and password
• Database uses username and password in database
You can explicitly grant or revoke access based on IP address or domain restrictions.

Web PL/SQL Generator Preferences


You can enforce security in three ways using Web PL/SQL Generator preferences:
• You cannot invoke a procedure out of context by entering a URL. Private
procedures use a boolean variable which you cannot set in the URL. Otherwise, it
defaults to false. The boolean variable is only set to true when the a public
procedure invokes the private procedure.
• You can deny users access to record by enforcing checksums. You can use
preferences to enforce the calculation of checksums.
• You can force authentication by ensuring that you enter a lower-case URL. You
can set a preference to force the URL to lowercase.

.....................................................................................................................................................
9-14 Oracle Designer 6i: Web PL/SQL Design and Generation
Summary
.....................................................................................................................................................

Web PL/SQL Application Security


The Web PL/SQL Generator provides two APIs that enable you to implement module
security based on user names and passwords:
• Authorized security (implemented by wsgsec.sql) requires an administrator to
set up the users and assign them responsibilities before they can access the module.
• Self-service security (implemented by wsgsr.sql) requires users to complete a
registration form the first time that they access the module.

.....................................................................................................................................................
9-15
®
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

Practice 9—1: Arguments and Web PL/SQL Modules


Goal
The aim of this practice is to restrict user access to records by passing an argument to a
module and to enforce security using Web PL/SQL Generator Preferences.

Scenario
You want your customers to be able to call the REN0020 - Title module to view
either movies or computer games by using a parameterized URL. You also investigate
calling a page out of context and forcing a URL to lowercase.

Your Assignment
Use the following information as your starting point:

Workarea Continue using the same workarea if you


have completed all practices or switch to
rescue workarea ORA<nn>_Les09_stp
Module REN0020 - Reserve a Title

where <nn> is the group number that your instructor has assigned to you.

Using Arguments to Restrict Access


1 Create an argument for the REN0020 module. Set the name and datatype as
follows:
.

Property Value
Name Z_TTE_TYPE
Datatype VARCHAR2

2 Create an item usage for the argument. Associate the argument, Z_TTE_TYPE,
with the bound item TTE_TYPE.
3 Ensure that the SECECS - Enforce URL Checksums preference is set to
‘No’.
4 Generate and install the module.
5 Use the Build Actions window to inspect the code for the package body. Where
does the argument Z_TTE_TYPE appear?
6 Run the module by entering a URL similar to the following:
http://<webserver>/<your_agent>/reserve$.startup?Z_TTE_TYPE=MO
7 Click the Find button. What type of records appear in the record list?
8 Click the Query button. Enter COUNTDOWN into the Title field. What is the result?

.....................................................................................................................................................
9-16 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 9—1: Arguments and Web PL/SQL Modules
.....................................................................................................................................................

Preventing a Call Out of Context


Use the following information as your starting point:

Module MEM0010 - Maintain Personal Details

9 For the module, set the Security category of Generator preferences to:
Force the calculation of checksums.
a
b Force lowercase URLs.
10 Generate and install the module. Run the module by entering the following URL.
What happens?
http://<webserver>/<your_agent>/personal$cus_rmc.actionquery
11 What happens when you enter the following URL?
http://<webserver>/<your_agent>/
personal$cus_rmc.actionquery?Z_DIRECT_CALL=TRUE
12 Run the module by calling the startup procedure.
13 Navigate to the view form for customer 150. What value is displayed in the URL?
14 Edit the URL. Change the value of P_CTR_ID to 152. What happens?

.....................................................................................................................................................
9-17
®
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

Practice 9—2: Implementing Self-Service Security


Goal
The aim of this practice is to restrict user access to records by asking the user to sign in
before using the application.

Scenario
At the moment, any user who can access the MEM0010 - Maintain Personal
Details module can access the records of any customer. You want to restrict
individuals to their own records.

Your Assignment
Use the following information as your starting point:

Module MEM0010 - Maintain Personal Details

1 Install the security package into your user from the hwd_sec.sql file in your
working directory. It is based on the supplied wsgsr.sql file but accesses user
information from the CUSTOMERS table.
2 Set the Security preferences for the module:
– SECECS – Enforce URL Checksums preference to Yes
– SECPKG – Security Package Name to HWDSEC
– SECVAL – Perform Session Validation to Y
3 Generate, install and run the module.
a The Hollywood customers have been assigned usernames and passwords that
are the same as their last names. Enter a username and password into the
security form and click the Log on button.
b What problem is there?
c Close the browser (to clear the security information stored in the cache).
4 Create an argument for the module to ensure that a user can only query the
customer record that corresponds to the entered username and password.
5 Generate, install and run the module. Check that you can only access the record for
the username you entered.
6 Close the browser and run the module again. Register as a new customer.

.....................................................................................................................................................
9-18 Oracle Designer 6i: Web PL/SQL Design and Generation
Hints
.....................................................................................................................................................

Hints
Practice 9—1

To perform this task Follow these steps


Creating a module 1 In the Navigator, open the Modules node.
argument 2 Open the node for your selected module.
3 Select the Arguments node.
4 Click Create.
5 Use the Property Palette to enter the name and datatype of the
argument.
6 Click Save to finish.
Creating an argument 1 In the Navigator, expand the node for the argument.
item usage 2 Select the Argument Item Usages node.
3 Click Create.
4 Use the dialog box to associate your argument with a bound
item.
5 Click OK.

Practice 9—2
There are no hints for this practice.

.....................................................................................................................................................
9-19
®
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

Instructor Notes

Schedule
Timing Topic
99
30 minutes Lesson
S ecurity an d W eb P L /S Q L A p plication s
20 minutes Practice
50 minutes Total

About this Slide


O verview
Point out that we are going to approach


C an I p reven t th e u ser accessin g certain d ata?
C an I p reven t th e u ser accessin g d ata o ut of
security from two viewpoints:
c on text?
• H o w d o es the serv er im p lem en t secu rity? • In the Web server
• C an I im plem en t secu rity fo r a W eb ap p lication ?

• In the generated application

9-2

About this Slide


Im plem entin g S erver S ecurity

• M o d ule arg um en ts
• W eb P L /S Q L G ene rato r:
– P reven t a call o u t o f co n te xt
– E n fo rce case-in sen s itive U R L
• W eb server:
– D e fin e valid u sernam es o r d o m ain s
– U s e D A D s and P L /S Q L A g ents
– S e t up secu re d irecto ries
• D atab a se:
– D e fin e u sers, roles a nd pro files

9-3

About this Slide


R estrictin g D ata A vailab le to a M od ule
R E N 070
A rgum ents
You pass the argument and its specified value
XY Z_P O S IT IO N
A llow able V alues
in the URL to provide context for queries.
A rg um ent Item U sa ges
abc P O S ITIO N
M odule
ht C om
tp: //we ponents
bs erver /ag ent /
em plo yees $. start up?Z _P OSITI ON =SAL ES
E M P _M C
Table U sages
Technical Note
B ound Item s


A pplicatio n Logic

C reate an arg um en t
The argument name MUST be the name of the


A ssoc iate w ith a b ou n d item
S et th e valu e in th e U R L
bound item prefixed by Z_. Other names are
9-4 accepted by the Design Editor but do not work.

.....................................................................................................................................................
9-20 Oracle Designer 6i: Web PL/SQL Design and Generation
There are no hints for this practice.Instructor Notes
.....................................................................................................................................................

About this Slide


Preven ting D irect C all o f a P age

B row ser:
This is important so do not rush through this.
http:// w e bserver/agent/em p$e m p_m c.queryv iew Take time to explain this slide.
Public procedures can be called by other
em p $ em p _m c .q u e ry
e mvpi$e
ewm?pZ_
_mDcI.q
REuCeTry
_CvAiLew
L= T R UE
generated PL/SQL procedures. The calling
access d en ied
enied procedure passes Z_DIRECT_CALL = TRUE
to the called procedure. Z_DIRECT_CALL
9-5
has a default of FALSE, so if you call it from a
URL, Z_DIRECT_CALL defaults to false and
the procedure does not execute.
You can only create arguments based on items
the module uses. So you can’t create a
parameter Z_DIRECT_CALL and add it to the
URL.
About this Slide
U sin g C h ecksum s

em p$ emp_ mc. que ryvie w


Take some time to explain what is happening
?P_E MPN O= 7845
7844&&Z
Z__CHK=
CHK= 71
71228
8
here.
B ro w ser:
http://host:9999
Some public procedures can be called by both
other generated PL/SQL procedures and from
a URL. When called from a URL, they are
emp$em p_mc.query view
?P _EMPNO=784 5&Z_CHK=71 28 passed a checksum value. If the call is made
9-6
from a URL, Z_DIRECT_CALL is FALSE, so
the checksum value is validated. If the
checksum is not correct for the record you are
trying to access, you get an error message.
When called from a generated PL/SQL
procedure Z_DIRECT_CALL is TRUE, and
the checksum is not validated, as a call from a
generated PL/SQL procedure is legitimate.
The procedures to calculate and validate the
checksum are found in package WSGL in the
WebServer Generator Library.
About this Slide
S erver A u tho rizatio n

®
There are courses that deal with this subject:
h ttp:// W eb S erver
• Oracle Web Application Server:
L istener Administration
• A u th en ticatio n
– B asic o r d ig est • Oracle Web Application Server: Develop
• R estric tio n
– IP ad dresses
Web-Based Applications
– D o m ain n am es

9-7

.....................................................................................................................................................
9-21
®
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

About this Slide


Fo rcing A u then ticatio n
ht tp ://w ebs erv er/ag en t/em p$. sta rtup

S ecurity invo ked

B ro w ser:
h ttp ://h o st:9 99 9

P rotected path: ag en t/emp $*

S ecurity evade d

ht tp ://w ebs erv er/ag en t/EM P$. sta rtup

9-8

About this Slide


A u tho rized S ecurity
B row ser:
http://
K now n user
R e nt a M o v ie
w ith acc ess
Title
C a te gory

B ro w serL o gon R eq uired


http://U sernam e:
B ro w ser
P as sw ord: K now n user http://
w ith no access A cces s D e nied
Yo u d o n o t h ave p erm issio n to
use th is app lication

Logo n

E nters U R L
U nk now n
B ro w ser:
us er h ttp :// alid
Inv Lo go n

Error!
LoAgo
cc en
s sRe
de nie
qud ired
U sernam e:

Passw ord:

9-9

Demo
The account for your username includes an authorized security implementation. It
consists of the WSGSEC tables, the table API and two Web PL/SQL modules that
you can use to insert records:
• resp enables you to maintain a list of responsibilities
• users enables you to maintain user names, passwords and the responsibilities to
which they belong.
There is also a server model diagram, AUTH_SECURITY, which shows the
relationships between the tables.
Set the following preferences for the MEM0010 module:
• SECPKG to WSGSEC
• SECVAL to Y
• SECRES to the name of one of the responsibilities (for example, USER)
Generate, install and run the module. Enter a variety of user names to show the
difference between the situation where the user is known but belongs to a different
responsibility and the situation where the user is unknown.

.....................................................................................................................................................
9-22 Oracle Designer 6i: Web PL/SQL Design and Generation
There are no hints for this practice.Instructor Notes
.....................................................................................................................................................

About this Slide


Im p lem en tin g A u thorized S ecu rity

• S E C V A L , S E C P K G an d S E C R E S p re feren ces
• T ab les th at s to re u sers a nd resp o ns ib ilitie s
• S ecu rity p ackag e

USER PACKAGE
R E S P O N S IB ILITY P E R M IS S IO N S

USER R E S P O N S IB ILIT
ILITYY

9-10

About this Slide


S elf-S ervice S ecurity
B row ser
This security mechanism is the subject of a
http://

First tim e R eg ister w ith H olly w o od


Nam e
practice.
Ad dres s
P o stcod e

D ate of Birth

B row ser

http://
S ubseq uent P lease sign in
acces ses

U ser R egister

P assw ord

9-11

About this Slide


Im p lem entin g S elf-S ervice S ecu rity

• S E C V A L , S E C P K G an d S E C R E S p re feren ces
• T ab le th at sto res u ser d ata
• S ecu rity p ackag e

U S E R D A TA

9-12

About this Slide


S um m ary

• S erver autho rizatio n is b ased o n d o m ain s o r IP


a dd res ses
• W eb P L /S Q L G ene rato r P referen ces help to
p reven t breach es o f secu rity
• A W eb P L /S Q L ap p licatio n can im p lem en t
a uth orized or self-s ervice secu rity

9-13

.....................................................................................................................................................
9-23
®
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

.....................................................................................................................................................
9-24 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Post Lesson Teaching Evaluation
.....................................................................................................................................................

Instructor Post Lesson Teaching Evaluation


Name: Full Email:

Course Name: Oracle Designer 6i: Web PL/SQL Design and Generation
Lesson number: 9
Number of teaches before filling this form: 1 - 2 - 3 to 5 - >5

Global comments: (circle all that apply)


• Lesson content: Trivial - Too easy - OK - Difficult - Too difficult
• Slide content: Too many slides - Too few slides - O.K
• Text content.Too much text - Not enough text - Unclear - O.K.
• Practice content: Too difficult - Too easy - Problems - O.K.

Detail comments
Content type: Slide - Text - Practice - Instructor notes
Note: 1:needs animation - 2:too much animation - 3:needs more text - 4:too much text
- 5:Unclear - 6:not necessary - 7:Other

Content Page
Note Comments/Suggestions
Type Number

Photocopy this page and fax to: Oracle Designer Curriculum Development @ +(44) 118.924.5181
Additional sheets are available at the end of the instructor’s guide.
If you draw additional diagrams on the white board use the Graphic sheet in the Instructor Evaluation
section at the end of this book.

.....................................................................................................................................................
9-25
®
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

.....................................................................................................................................................
9-26 Oracle Designer 6i: Web PL/SQL Design and Generation
Suggested Graphics
.....................................................................................................................................................

Suggested Graphics
Instructor name: Full email:

Course Name:Oracle Designer 6i: Web PL/SQL Design and Generation


Lesson No: 9 Page No:
Please sketch your additional diagram below.

.....................................................................................................................................................
9-27
®
Lesson 9: Security and Web PL/SQL Applications
.....................................................................................................................................................

Oracle Designer Education Products


Curriculum Development
520 Oracle Parkway
Thames Valley Park
Reading - Berkshire
England

fold here

.....................................................................................................................................................
9-28 Oracle Designer 6i: Web PL/SQL Design and Generation
10
.................................

Completing Your
Application
Lesson 10: Completing Your Application
.....................................................................................................................................................

Introduction
Your finished Web PL/SQL application consists of more than just a series of
free-standing modules. In order to build your completed application, you must be able
to link modules together, create menu structures, create a module hierarchy, and link to
external Web sites.
Schedule
Overview See Page 29

About this Slide


• What types of module are there? See Page 29
• How do I create a launch-pad module?
• How do I use menu modules?
• How do I link modules into a network?
• How do I link to other Web sites?
• Can I distribute the application across user
accounts?

10-2

Topic See Page


Introduction 2
Web PL/SQL Module Types 4
Creating Screen Modules with No Data Usages 5
Creating Menu Modules 7
Defining a Module Network 8
Menu Styles 11
Using Action Items to Control Navigation 12
Repeating Modules in the Network 14
Defining Links to External Web Pages 15
Generating the Module Network 17
Distributing a Web PL/SQL Application 18
Summary 20
Practice 10—1: Creating a Launch Page Module 21
Practice 10—2: Using Menu Modules to Create a Menu Structure 22

.....................................................................................................................................................
10-2 Oracle Designer 6i: Web PL/SQL Design and Generation
Introduction
.....................................................................................................................................................

Topic See Page


Practice 10—4: Creating a Module Network 25
Practice 10—5: Linking to a URL 26

Objectives
At the end of this lesson, you should be able to do the following:
• Create menu modules
• Control navigation using action items
• Generate a module network

.....................................................................................................................................................
10-3
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

Web PL/SQL Module Types


It is important that you understand the difference between a Web PL/SQL screen
module that you use as a menu and a Web PL/SQL menu module.
Demo
Web PL/SQL Module Types See Page 29

http://

• Screen modules • Menu modules


– Generate into – Are not generated
PL/SQL packages – Link screen
– May contain table modules
usages – Affect screen
module layout

10-3

Screen Modules
The Web PL/SQL Generator generates screen modules:
• It creates output files that contain PL/SQL package definitions for each screen
module.
• Functional screen modules have components. You use them to access the
application data and carry out the application’s business functions.
• Menu screen modules do not have table usages. You use them to implement menu
systems.

Menu Modules
The generator does not generate, or produce output files for, menu modules:
• Menu modules affect the layout of the screen modules that own them.
• When you build the module network, you typically use menu modules to link
between screen modules.
• The top menu module in a network appears on the startup page of the screen
module that owns it.
If you want to create a menu system that enables users to access different parts of the
application, you must use a menu screen module.

.....................................................................................................................................................
10-4 Oracle Designer 6i: Web PL/SQL Design and Generation
Creating Screen Modules with No Data Usages
.....................................................................................................................................................

Creating Screen Modules with No Data Usages


You can define a screen module that does not use any data and use it as the basis for a
menu system.
About this Slide
Screen Modules with no Data Usages See Page 29

Page Header
• Startup page
Title
• About page
Help
• Links to other modules

Navigation links

Page Footer

10-4

What Is Generated when a Module Has No Data Usages?


When you generate a screen module, the generator always creates a startup page and
an about page. If the module does not have any module components, it only creates
startup page and an about page. Modules that do not have components are very useful
for building menus. You can suppress the link to the startup page by setting the
MODALR - Startup Page: About Page Hyperlink preference to No.

Launch Page Modules


You may wish to create a launch page for your application. A launch page does not
use data in the database but enables you to access distinct portions of the application.
A launch page normally starts with an introduction to the application. It also contains a
set of hyperlinks to the rest of the modules within the application. The launch page
derives its content from the top-level module definition and the module network.

.....................................................................................................................................................
10-5
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

How to Create a Launch Page Module


You can generate a launch page for your Web PL/SQL application by defining a top-
level module and links to other modules in the Design Editor:
1 Select Options—>Use Property Dialogs.
2 In the Navigator, select the module node and click Create.
3 Enter the following mandatory properties:
– Module Type, Module Short Name, Purpose, Language.
4 Click Next, and enter a suitable title for the Web PL/SQL application (use the
Startup Page title).
5 Click Next, and enter an Implementation Name.
6 To enter user text for the launch page:
a Click Next to display the User Text tab.
b Select Top of First Page, or Bottom of First Page and enter the text required.
You can format User text with PL/SQL functions and HTML syntax. Alternatively,
click the Text Editor or HTML Editor button and then use your preferred editors to
enter the text required (Options—>Text Editor Options...).
7 Click Next to define hyperlinks to other modules in the application:
a Click Select Modules and choose the set of modules to link to, from the
launch page module.
b If there is more than one called module, use the Up and Down arrows to define
the order in which the launch page module displays the hyperlinks in the
application.
8 Click Finish to save.

.....................................................................................................................................................
10-6 Oracle Designer 6i: Web PL/SQL Design and Generation
Creating Menu Modules
.....................................................................................................................................................

Creating Menu Modules


You can use menu modules to link between a launch page module (which does not use
data) and your functional screen modules.
About this Slide
Menu Modules See Page 30

REN0001 Head Office Menu


Head Office
From here you can access the
following pages:
MNU0020
Titles / Rentals
TITLES / RENTALS

• Titles
• Rentals
REN0020 REN0010
Titles Rentals
Short
menu title

10-5

Menu modules are useful for linking screen modules together, to form menu
hierarchies.
You cannot select a menu module to generate, nor does the generator create any output
for a menu module. Instead, menu modules affect the layout of the screen modules that
own them. When you generate a screen module which owns a menu module, the
generator does the following:
• Places the Top Title of the menu module on the startup page of the screen module.
• Creates hyperlinks to any screen modules which the menu module owns. The
hyperlinks appear on the startup page of the screen module that owns the menu
module. They appear under the title of the menu module.
If you have more than one menu module in the hierarchy below the launch page
module, the title of each menu module appears on the startup page. The generator
groups the hyperlinks to any screen modules which the menu module owns under the
menu module title.
If a menu module has a child menu module, then the Top Title of the child menu
module appears indented under the Top Title of its parent. You can use menu modules
to create a hierarchy of links to the children of a screen module.

.....................................................................................................................................................
10-7
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

Defining a Module Network


To combine a set of modules into one integrated application you may need to further
define the structure of the application by setting up module network links.

About this
Defining a Module Network Slide
Modules
See Page 30
Holly Screen - no data usage
Module Network
REN0001

MNU0010 MNU0020 Menu

REN0010

REN0020 Screen

• Link: • Create a hierarchy


– Screen to screen
– Screen to menu
– Menu to screen
10-6

Module Network
A network consists of inter-linked modules. Each module may have one or more
parent modules and one or more child modules.
From the Design Editor you can define a module network for a client application in the
following ways:
• Use the Module Network Viewer.
• Expand the node for the chosen module and then create Called Modules.
• Add called modules to a module diagram.

.....................................................................................................................................................
10-8 Oracle Designer 6i: Web PL/SQL Design and Generation
Defining a Module Network
.....................................................................................................................................................

Module Network Viewer


The Module Network Viewer in the Design Editor allows you to define the menu
structures and the calling sequences for generated applications.

About this
/D

Using the Module Network Viewer Slide


Modules root
See Page 30
Holly
Module Network full Demo
REN0001
See Page 30
MNU0010 MNU0020

REN0010

REN0020
leaf

• Root: children only


• Full: parent and children
• Leaf: parent only
• Solo: no parent or children
10-7

You can use the Module Network Viewer to display the module network vertically, or
horizontally (as shown in the graphic). The horizontal view is particularly useful for
viewing menu structures. The names of menu modules are dimmed to distinguish them
from other types of modules.
You can perform the following tasks using the Module Network Viewer:
• Add modules to a module network.
• Change the structure of module networks.
• Copy menu structures.
• View module networks.

Module Connectivity
You classify a module by how many parents and children it has:
• A full module has parents and children.
• A root module has children but no parents.
• A leaf module has parents but no children.
• A solo module has no parents and no children.

.....................................................................................................................................................
10-9
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

Linking Screen Modules


Demo
Linking Screen Modules See Page 30

Page Header
• Links appear on the
parent startup page Title
– Direct links to Help
screen modules • Menu module title
– Links to children of • 1st Child module hyperlink
menu modules • 2nd Child module hyperlink
• 3rd Child module hyperlink

Page Footer

10-8

If a screen module has a child, the generator defines a hypertext link on the startup
page of the module. When a user clicks on this hypertext link, the browser invokes the
startup page for the child module. If you have not generated and installed the PL/SQL
for the child module, the user sees an error message.
You can tell the Web PL/SQL Generator to generate a module’s children when you
generate the parent module by selecting the Include the Module Network? check box
on the Generate Module dialog.

.....................................................................................................................................................
10-10 Oracle Designer 6i: Web PL/SQL Design and Generation
Menu Styles
.....................................................................................................................................................

Menu Styles
You can use Generator Preferences to instruct the generator to use either the Top Title
or the Short Title of a child module in the hypertext link.

About this Slide


Menu Styles See Page 31
Head Office Menu

From here you can access the MODMNS=LONG


following pages:

• Title Reservations and Rentals MODMNS=SHORT

• Titles
• Rentals Head Office Menu
From here you can access the
following pages:

• TITLES / RENTALS
Module [Titles][Rentals]
hyperlink

10-9

When you create a module, you use the Titles tab to define:
• Top Title (Hyperlink Text)
• Short Title (Startup Page Title)
You use a preference to choose which of these titles should appear in the hypertext
link. Set the MODMNS - Menu Style preference to:
• Long Title to use the child module’s Top Title.
• Short Title to use the child module’s Short Title.
Because you set the preference against the parent module, all the links from that
module to child modules must use either long titles and short titles.

.....................................................................................................................................................
10-11
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

Using Action Items to Control Navigation


The Web PL/SQL Generator supports action items that enable the user to navigate to a
module component in the same module or to another module. Navigation action items
take precedence over the default hyperlinks.

Navigating Using Action Items

• Override default hyperlinks


• Define at module component and window level
• Specify the prompt
• Specify whether the item is a
– Button
– Hyperlink
– Image link

10-10

Navigating Within the Same Module


In a master–detail scenario, you use an action item to navigate to a specific point
within the same module. You create two module components within the module and
link them using the foreign key, thus creating a key-based link. If you do not place the
module components in the same window, the Design Editor creates the navigation
action item automatically. Set the AINMCF – Module Component Form to
navigate to preference to specify the module component to which you want to
navigate.

Hyperlinks on the Startup Page


You use an action item to navigate to module components that have no master in the
module. The generator creates action items on the startup page to link to the module
components. Set the MODBML – Build Links to module Components without
Master preference to No if you do not want these additional hyperlinks.

Navigating to a Different Module


You can use navigation action items to navigate to a different module. If you create a
module network link, the Design Editor creates a navigation action item in the calling
module. You cannot specify to where in the module you want to navigate.

.....................................................................................................................................................
10-12 Oracle Designer 6i: Web PL/SQL Design and Generation
Using Action Items to Control Navigation
.....................................................................................................................................................

How to Create a Navigation Action Item


You can display action items as buttons, hyperlink items and image link items.
About the slide
Using Navigation Action Items See Page 31
Navigation Action Item Properties
• Button
Prompt Help Demo
Icon Name
See Page 31
Create Button?
+ Yes

• Hyperlink Navigation Action Item Properties

Prompt Help

Icon Name

Create Button?
+ No

• Image link Navigation Action Item Properties

Prompt Help

Icon Name help.gif

Create Button? No

10-11

1 In the Design Editor, select Options—>Use Property Dialogs.


2 In the Navigator, expand the module component or window according to the
required location of the action item.
3 Select the Action Items node and click Create.
4 Select Navigation within the module or Navigation to a different module.
5 Click Next and enter a name and prompt for the item (if you choose to display the
item as an image, the prompt becomes hint text for the image).
6 Click Next and select the module or module component to which to navigate.
7 Click Next to navigate to the Button dialog (you may need to click Next several
times if creating a link to another module).
– Select Create button to display the action item as a button.
– Clear Create button to display the action item as hyperlink text.
– Specify an Image name and optionally Image width/Image height to display
the action items as an image link.
8 Click Finish to save.

.....................................................................................................................................................
10-13
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

Repeating Modules in the Network


You may choose to make the same screen module available from more than one menu
in your application system.

About this Slide


Repeating Modules in the Network See Page 31
Modules
Holly
Module Network
REN0001
MNU0010 MNU0020

REN0010 REN0020
REN0020 REN0040
Top Level Menu
REN0030 From here you can access the
following pages:

• Repeat call to module • First menu title


from a menu or screen •Hyperlink to REN0010
module • Hyperlink to REN0020
• Still only one definition of • Second menu title
the module •Hyperlink to REN0020

10-12

Typically, in an application, you need to link modules in a network, where each


module may have multiple parents and multiple children. You can repeat a single
module within the network. Even though the network includes more than one
reference to a module, there is still only one definition of that module in the repository.
As the graphic shows, the repeated module is a child of two modules. You can now
access the same module from two different menu systems.
Note: The PL/SQL used to implement the module exists only once in the database.
The generator embeds the URL to execute the child module into the separate parent
modules.

.....................................................................................................................................................
10-14 Oracle Designer 6i: Web PL/SQL Design and Generation
Defining Links to External Web Pages
.....................................................................................................................................................

Defining Links to External Web Pages


You can include hyperlinks to pages on the Web that are not part of the generated
application.
About the slide
Defining External Web Links See Page 32
Edit Module REN9999
Titles

Hyperlink text
text for hyperlink

URL
http://www...

• Create a placeholder module


• Enter the URL of the external Web site
• Link to the module network
• Generate
10-13

How to Create a Placeholder Module for a Web Page


1 Create a module.
2 Enter the following mandatory properties:
– Module Type
– Module Short Name
– Purpose
– Language
3 On the Titles tab, enter suitable text for the hyperlink.
– Startup Page Title (Top Title) if the menu style is Long Titles.
– Hyperlink text (Short Title) if the menu style is Short Titles.
4 Enter the URL for the HTML page to which you want to link.
5 Click Finish to save.
Note: The modules you create especially to link to static pages should not contain
module components or have child modules.

.....................................................................................................................................................
10-15
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

Generating the Link to an External Web Page


Use the Module Network Viewer to add the placeholder module to your module
network in the appropriate place.
Demo
Generating External Web Links See Page 32
Top Level Menu • Child module is not
generated
From here you can access the
following pages: • Hyperlink to external
site is included in the
• First menu title menu
• Hyperlink to REN0010
• Hyperlink to REN0020

• Second menu title External Web Page


• Hyperlink to external site

Dream
Getaways • Further link

XXXX XXXX

10-14

When the generator comes across a URL in the module network, it does not generate
the child module. It creates a hyperlink on the generated parent module that points to
the URL which you entered for the child module.
When you follow this link you do not execute the child module. Instead, you open the
URL to which the module points.

.....................................................................................................................................................
10-16 Oracle Designer 6i: Web PL/SQL Design and Generation
Generating the Module Network
.....................................................................................................................................................

Generating the Module Network


Once you have completed the module network, you can generate the Web PL/SQL
application. Whenever you modify a module definition, the module network, or any of
the preferences, you must generate all or part of the Web PL/SQL application again.
About this Slide
Generating the Module Network See Page 32

Generate Web PL/SQL

Module launch page


REN0001
module
Include Module Network?
Installation user password

Start Options Cancel Help

10-15

1 In the Navigator, select the launch page module to generate. Ensure that the
module you select is the top-level module.
2 Select Generate—>Generate Module....
3 Select Include the module network? to generate the module network.
4 Enter any other options that you require.
5 Click Start.

.....................................................................................................................................................
10-17
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

Distributing a Web PL/SQL Application


You can define a Web PL/SQL application that gets its data from different application
user accounts. These can be in different schemas on the same server, in a different
database, or in another schema in the same database. The source of the data is
transparent to the user of the Web PL/SQL application.

About this Slide


Distributing the Application See Page 32

myAgent1 myAgent2

8 8
Store Menu
REN0001

Customers Memberships Titles Rentals


MEM0010 MEM0020 REN0020 REN0010

10-16

Creating Links to Distributed Modules


When you have identified the modules that you are going to install in a different user
account, you need to tell the parent module where to find them. You do this within the
module design by adding a URL that points to the entry point procedure for that
module. The URL of the module indicates the application user account by referring to
a specific agent.
http://myServer/myAgent2/reserve$.startup

Example
In the graphic, REN0001, MEM0010 and MEM0020 are installed in the default
database while REN0010 and REN0020 are installed in another database.

.....................................................................................................................................................
10-18 Oracle Designer 6i: Web PL/SQL Design and Generation
Distributing a Web PL/SQL Application
.....................................................................................................................................................

Installing a Distributed Module Network


You must generate these module networks (or subnetworks) separately and install
them into their target databases.

Example
1 Using the example from the graphic, you generate and install the module network
from the top-level module (REN0001) using the default database connection.
This process generates modules MEM0010, MEM0020, and REN0001,
which contains hyperlinks to modules REN0020 and REN0010.
2 You then generate and install modules REN0020 and REN0010 into the other
application user account using a different database connection.

Using a Distributed Application


About this Slide
Using the Application See Page 32
http://myServer/myAgent1/rental_menu$.startup

Store Menu
• Members
• Customers
• Memberships
• Titles / Rentals
http://myServer/myAgent2/reserve$.startup
• Titles
• Rentals
Reserve a Title
TITLES
Enter query criteria for TITLES
xxxx XXXX
xxxx XXXX
xxxx XXXX
xxxx XXXX

XXXX XXXX

10-17

You enter the top-level module by entering its URL (accessing the default database).
For example, the following URL executes the startup procedure of module REN0001:
http://myServer/myAgent1/rental_menu$.startup
The startup page of the module contains a hyperlink to the REN0020 module
(accessing another application account):
http://myServer/myAgent2/reserve$.startup

.....................................................................................................................................................
10-19
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

Summary

Summary

• Using different module types


– Screen
– Menu
• Creating module networks
• Using navigation action items
• Linking to Web pages
• Distributing Web PL/SQL applications

10-18

The Web PL/SQL Generator uses screen and menu modules. However, you only ever
explicitly generate screen modules. Menu modules add a hyperlink to the layout of
their parent screen modules.

Linking Modules
Modules rarely exist in isolation. An application consists of many interlinked
modules.
The links to the children of a module appear on the startup page. You can set the
MODMNS – Menu Style preference to control which title the generator uses. If a
screen module owns a menu module, the menu module’s title creates a subheading on
the screen module.

Navigating with Action Items


You can customize your application by defining navigation actions items which take
precedence over the default hyperlinks. They are used to navigate to other areas of the
same module or to a different module.

Linking to External URLs


You can create links to other URLs to allow the user to navigate to Web pages outside
the application.

.....................................................................................................................................................
10-20 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 10—1: Creating a Launch Page Module
.....................................................................................................................................................

Practice 10—1: Creating a Launch Page Module


Goal
The purpose of this practice is for you to use the Design Editor to create a Web
PL/SQL Screen Module without data usages as a launch page module.

Scenario
The developers have now delivered a number of completed modules for the
application system. In the real world these modules do not exist in isolation. They
must be linked together by a menu structure. Your first task is to create a launch page
or introductory module for the Hollywood Rentals e-commerce site.

Your Assignment
Use the information below as your starting point:

Workarea ORA<nn>_Les10_stp
Module REN0001 - Rental Store Menu

where <nn> is the group number that your instructor has assigned to you.
1 Using the Design Editor, create a module REN0001 – Rental Store Menu:

Property Setting
Module Type Default
Module Short Name REN0001
Module Name RENTAL STORE MENU
Language Web PL/SQL
Implementation Name rental_menu

2 Add the following user text to the Default Area:


htf.header(’Welcome to Hollywood Rentals!’)
3 Generate, install, and run the module.

.....................................................................................................................................................
10-21
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

Practice 10—2: Using Menu Modules to Create a Menu


Structure
Goal
The purpose of this practice is for you to use the Design Editor to link menu modules
to create a menu structure for the Hollywood Rentals e-commerce site.

Scenario
You need to build the menu structure for Hollywood to allow navigation to all modules
in the application. You need to create two menu modules, MNU0010 - General,
and MNU0020 - Members. You must then link these modules to the launch page
module to create a menu structure.

Your Assignment
Use the information below as your starting point:

Module MNU0010 - Catalog


MNU0020 - Members

1 Using the Design Editor, create a menu module with the following details:

Property Setting
Module Type Menu
Module Short Name MNU0010
Module Name GENERAL
Language Web PL/SQL
Short Title (Hyperlink text) Catalog
Top Title (Startup Page title) Access our catalog

.....................................................................................................................................................
10-22 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 10—2: Using Menu Modules to Create a Menu Structure
.....................................................................................................................................................

2 Using the Design Editor, create a menu module with the following details:

Property Setting
Module Type Menu
Module Short Name MNU0020
Module Name MEMBERS
Language Web PL/SQL
Short Title (Hyperlink text) Members
Top Title (Startup Page title) Members Only

3 Link the menu modules to the launch page module REN0001.


4 Generate, install, and run module REN0001.
Note: You cannot generate a menu module.
5 What effect do the menu modules have on the appearance of module REN0001?
6 How would you display the short form of the menu title?

.....................................................................................................................................................
10-23
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

Practice 10—3: Building an Online Help System


Goal
The purpose of this practice is for you to implement an online help system for the
Hollywood e-commerce site.

Scenario
To help customers use the Hollywood e-commerce site you need to build an online
help system which they can access from any module in the application. You need to
build a module and add help using the user text areas. You then need to build a
standard header for all modules which includes a link to the online help.

Your Assignment
Use the information below as your starting point:

Module HLP0010 - ONLINE HELP

1 Using the Design Editor, create a new module with the following details:

Property Setting
Module Type Default
Module Short Name HLP0010
Module Name HELP
Language Web PL/SQL
Top Title (Startup Page title) Hollywood Rentals Help
Implementation Name holly_help

2 Write help information of your choice for the Hollywood system into the Top of
First Page user text area.
3 Generate, install and run the module.
4 Use the GENERAL preference set to place a link to the online help module from all
pages of all modules in the application (except module HLP0010 itself).
5 Generate and install the HLP0010 module again.
6 Generate, install and run REN0001.
a Do you see a link to the online help at the top of the page?
b Does the link work?

.....................................................................................................................................................
10-24 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 10—4: Creating a Module Network
.....................................................................................................................................................

Practice 10—4: Creating a Module Network


Goal
The purpose of this practice is for you to use the Design Editor to construct a module
network for the Hollywood Rentals e-commerce site.

Scenario
You and your colleagues have now created all the functional modules for the
application, a launch page module and two menu modules. Your task now is to link the
modules together so that users can navigate sensibly from one to another.

Your Assignment
Use the following information as your starting point:

Module REN0001 - Rental Store Menu

1 Create a navigable network for each menu module:


Link modules REN0030 and REN0040 to menu module MNU0010.
a
b Link modules REN0010 and MEM0010 to menu module MNU0020.
2 Generate, install, and run module REN0001.
3 What appears on the module Startup Page now?

.....................................................................................................................................................
10-25
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

Practice 10—5: Linking to a URL


Goal
The purpose of this practice is for you to create a link in your application to a URL.
This may be a link to an external Web page or to a module that requires and argument.

Scenario
The customers want to be able to navigate from the application to the home page of the
Internet Movie Database. You also want to add two options to access either movies or
games through the REN0020 - Reserve a Title module.

Your Assignment
Use the information below as your starting point:

Module IMDB — Internet Movie Database


REN0021 - Reserve a Movie
REN0022 - Reserve a Game

Linking to an External Page


1 Using the Design Editor, create a module using the following details:

Property Setting
Module Type Default
Module Short Name IMDB
Module Name EXTERNAL1
Language Web PL/SQL
Top Title (Startup Page title) The Internet Movie Database
URL /webapp/homepage/www_imdb_com.html
Implementation Name imdb

2 Link the external module to REN0001.


3 Generate and install the IMDB module.
4 Generate, install, and run REN0001. Follow the new link. Do you get to where
you expected?

.....................................................................................................................................................
10-26 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 10—5: Linking to a URL
.....................................................................................................................................................

Linking to a Parameterized Module


5 Using the Design Editor, create a module using the following details:

Property Setting
Module Type Default
Module Short Name REN0021
Module Name RESERVE A MOVIE
Language Web PL/SQL
Top Title (Startup Page title) Browse through Movie Titles
URL reserve$.startup?z_tte_type=MO
Implementation Name movies

6 Link REN0021 to MNU0010.


7 Create a module using the following details:

Property Setting
Module Type Default
Module Short Name REN0022
Module Name RESERVE A GAME
Language Web PL/SQL
Top Title (Startup Page title) Browse through Game Titles
URL reserve$.startup?z_tte_type=GA
Implementation Name games

8 Link REN0022 to MNU0010.


9 Generate and install REN0021 and REN0022.
10 Generate, install, and run REN0001. Follow the new links and ensure that you can
only access either movies or games. You may consider other changes that would
make the form more usable (such as, making only the title queryable).

.....................................................................................................................................................
10-27
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

Hints
Practice 10—1
There are no hints for this practice.

Practice 10—2
To perform this task Follow these steps
To create a menu 1 In the Navigator, select the Modules node.
module 2 Click Create.
3 Select Menu as the module type.
4 Click Finish.
To create a menu 1 Expand the Modules node.
structure in the 2 Expand the parent module node.
Navigator 3 Add the child modules:
a Select the Called Modules node.
b Click Create.
c Select Module from the Create Module Network dialog.
4 Click Finish to save.
To create a menu 1 Open a module diagram.
structure in the 2 Click Link Module:
Module Diagrammer a Click to the right of the module to specify that it calls a
module.
b Click to the left of the module to specify that it is called by
a module.
3 Select modules from the Create Module Network dialog.
4 Use the Properties palette to set the sequence property
appropriately.

Practice 10—3
There are no formal hints for this practice.

Practice 10—4
There are no formal hints for this practice.

Practice 10—5
There are no formal hints for this practice.

.....................................................................................................................................................
10-28 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

Instructor Notes

Schedule
Timing Topic
10
10
40 minutes Lesson
C o m p letin g Y o ur A p plication
45 minutes Practice
85 minutes Total

About this Slide


O verview
Explain that a launch page module is an


W h at typ es o f m o d u le are th ere?
H o w d o I crea te a lau nch -p ad m od u le?
introductory page, with links to the functional


H o w d o I u se m en u m o d u les?
H o w d o I lin k m o d u les in to a n etw o rk?
areas of the application.
• H o w d o I lin k to o th er W e b sites?
• C an I d istrib u te th e app licatio n acro ss u ser Just as the data design can be distributed
a ccou n ts?
between different database instances, the
application can also be distributed.
10-2

You can find an example of a real-time Web


PL/SQL application at this URL:
http://wwwdasis.samhsa.gov/ows-
bin/owa/DASIS$.startup
(Drug and Alcohol Services Information
System)
Demo
W eb PL /S Q L M odu le T yp es
Demonstrate how a menu module is created.
h ttp://

• S creen m o d u les • M en u m o d ules


– G e nerate in to – A re n ot g en era ted
P L /S Q L p ackag es – L in k scre en
– M ay co n tain tab le m o d ules
u sa g es – A ffe ct screen
m o d ule layo ut

10-3

About this Slide


S creen M o dules w ith n o D ata U sag es
Explain that if a module does not use data, it
P age H eader


S tartu p pag e
A b o u t p age
Title
does not have any module components.
H elp
• L in ks to o th er m o d u les

N avig ation links

P age F ooter

10-4

.....................................................................................................................................................
10-29
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

About this Slide


M en u M od u les
Menu modules are a good way to group
R E N 0001
H ead O ffice
H ead O ffice M enu
From h ere you can access the
functional modules
follow ing pages:
M N U 00 20
Titles / R en tals
T IT L E S / R E N T A L S

• T itles
• R entals
R E N 0020 R E N 0 010
Title s R entals
S hort
m enu title

10-5

About this Slide


D efin in g a M od ule N etw o rk
M odules Make it clear that we have two module types
H olly S creen - no data usage
M odule N etw ork
R E N 0001
here.
M N U 0010 M N U 00 20 M enu

R E N 00 10
• REN0001, REN0020, and REN0010 are
R E N 00 20 S creen
screen modules.
• L in k: • C reate a hierarchy


S creen to screen
S creen to m en u
• MNU0010 and MNU0020 are menu
– M en u to screen modules.
10-6

About this Slide


U sing th e M o d ule N etw o rk V iew er
M odules root If there are questions about the Module
H olly
M odule N etw ork
R E N 0001
full
Structure Diagrammer (Release 1.3.2), explain
M N U 0010

R E N 00 10
M N U 00 20
that it has been replaced by this viewing tool in
R E N 00 20
leaf
the Design Editor.
• R o o t: ch ild ren on ly
• F ull: p aren t an d ch ild ren
• L eaf: p aren t o nly Demo
• S o lo: n o paren t or ch ild ren
10-7
Demonstrate the vertical and horizontal
layouts and how you can add a module to a
network.
Demo
Lin king S creen M od u les
Demonstrate:
P age H ead er
• L in ks ap p ear o n th e
p arent startu p p ag e Title • Screen module calling a screen module
– D irect lin ks to H elp
screen m o d ules
– L in ks to ch ild ren o f
• M enu m odule title
• 1st C hild m odule hyperlink • Menu module calling a screen module
m en u m o d ules • 2nd C hild m odule hyp erlin k
• 3rd C hild m odule hyperlink Use it to show the difference.
P age Footer

10-8

.....................................................................................................................................................
10-30 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

About this Slide


M en u Styles
H ead O ffice M enu Emphasize that this is done by using
From here you can access the
follow ing pages:
M O D M N S =LO N G
preferences.
• T itle R eservations and R entals M O D M N S =S H O R T

• T itles Point out that it is the menu style of the parent


• R entals H ead O ffice M enu
From here you can access the
follow ing pages:
module that determines the layout.
• T IT L E S / R E N T A L S
M odu le [Titles][R entals]
hype rlink

10-9

About this Slide


N avig ating U sin g A ctio n Item s

• O verrid e defau lt h yp erlin ks


• D efin e at m o d ule c om po nen t an d w ind o w level
• S p ecify th e p rom p t
• S p ecify w h ether th e item is a
– B u tto n
– H y perlin k
– Im a g e lin k

10-10

About this Slide


U sing N avigation A ctio n Item s
• B utto n N avigation A ction Item P roperties

P ro m p t H elp
The generated screen shots show the action
Icon Nam e

Create Bu tton ?
+ Y es
item displayed at the top of the page. This is
• H ype rlink N avigation A ction Item P roperties achieved by setting the action item ZONAIP -
P ro m p t H elp

Icon Nam e
Position on page preference to TOP at either
Create Bu tton ?
+ No

• Im age link N avigation A ction Item P roperties container, module or module component level.
P ro m p t H elp

Icon Nam e help.gif

Demo
Create Bu tton ? No

10 -11

Demonstrate creating action items displayed as


buttons, hypertext and images.
About this Slide
R ep eatin g M o du les in the N etw ork
M od ules
H olly
Point out that more than one area of an
M odule N etw ork
R E N 0001 application might need access to the same
M N U 0010 M N U 00 20

R E N 0010 R E N 0 020
module. It’s the same module but it can be
R E N 0020 R E NT0op
040L evel M enu
R E N 0030 From h ere you can access the
follow in g pages:
accessed from different points.
• R ep eat call to m od ule • First m enu title
fro m a m en u o r screen •H yperlink to R EN 0010
m o d ule • H yperlink to R EN 0020
• S till on ly o n e d efin ition o f • Second m enu title
th e m o du le •H yperlink to R EN 0020

10-12

.....................................................................................................................................................
10-31
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

About this Slide


D efin in g E xtern al W eb Lin ks
E dit M o dule R E N 9999 Explain that the generator does not generate
Titles
the module. It creates a URL pointing to the
H yperlink tex t
text for hype rlink

URL
external Web page. That URL exists in the
http://w w w ...
parent module.
• C reate a p la ceho ld er m o d ule
• E n ter th e U R L o f the external W eb site
• L in k to th e m o d u le n etw o rk
• G en era te
10-13

Demo
G en erating E xternal W eb L inks
T op L evel M enu • C h ild m o du le is n o t Demonstrate how you can move from the
g en era ted
From here you can access th e
follow ing pages: • H yp erlink to extern al
s ite is inclu d ed in th e
demo application to an external Web page.
• First m enu title m en u
• H yperlink to R E N 0010
• H yperlink to R E N 0020

• Second m enu title E xternal W eb Page


• H yperlin k to external site

Dream
Getaways • Further link

X XX X XXX X

10-14

About this Slide


G eneratin g the M odu le N etw o rk
Explain that if the child modules already exist,
G enerate W eb P L/S Q L

M odule R E N 0001
laun ch page
m o dule
you do not have to generate everything. You
Includ e M odule N etw ork?
Installation user passw ord only have to generate the launch page module.
S tart O p tions C an cel H elp
It uses the network information to create the
links to the child modules.

10-15

About this Slide


D istribu tin g th e A p p licatio n
Point out that this scenario might exist if you
wanted to keep one area secure, or if the
my Ag ent 1 myA gen t2

8 8
application was pulling together data from
Store M enu
R E N 0001
different functional areas.
C u sto m ers M em berships Titles R entals
M E M 0010 M E M 0020 R E N 0020 R E N 0010

10-16

About this Slide


U sing the A p plication
http: //mySe rver/m yAgent 1/rent al_men u$.sta rtup Emphasize that when using the application, we
Store M en u
• M em bers can’t see that the data could be coming from
• C ustom ers
• M em berships
• T itles / R entals
different sources.
• T itles
• R entals
R eserve a T itle
T IT L E S
E nter query criteria for T IT L E S
xxxx XXXX
xxxx XXXX
xxxx XXXX
xxxx XXXX

XXXX XXX X

10 -17

.....................................................................................................................................................
10-32 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Notes
.....................................................................................................................................................

About this Slide


S um m ary

• U sing d iffere nt m o du le types


– S c reen
– M en u
• C reatin g m o d u le n etw o rks
• U sing n avig atio n a ctio n item s
• L in kin g to W eb p ag es
• D istribu tin g W eb P L /S Q L ap p licatio n s

10-18

Practices
Emphasize that they must change workarea as specified—they need two additional
modules which are available to them in the Lesson 10 startpoint workareas.
Practice 10—5
Note that the URL given is relative to the environment in which you are working. If
you have full Internet access, you can suggest that they enter http://www.imdb.com
to access the live page.

.....................................................................................................................................................
10-33
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

.....................................................................................................................................................
10-34 Oracle Designer 6i: Web PL/SQL Design and Generation
Instructor Post Lesson Teaching Evaluation
.....................................................................................................................................................

Instructor Post Lesson Teaching Evaluation


Name: Full Email:

Course Name: Oracle Designer 6i: Web PL/SQL Design and Generation
Lesson number: 10
Number of teaches before filling this form: 1 - 2 - 3 to 5 - >5

Global comments: (circle all that apply)


• Lesson content: Trivial - Too easy - OK - Difficult - Too difficult
• Slide content: Too many slides - Too few slides - O.K
• Text content.Too much text - Not enough text - Unclear - O.K.
• Practice content: Too difficult - Too easy - Problems - O.K.

Detail comments
Content type: Slide - Text - Practice - Instructor notes
Note: 1:needs animation - 2:too much animation - 3:needs more text - 4:too much text
- 5:Unclear - 6:not necessary - 7:Other

Content Page
Note Comments/Suggestions
Type Number

Photocopy this page and fax to: Oracle Designer Curriculum Development @ +(44) 118.924.5181
Additional sheets are available at the end of the instructor’s guide.
If you draw additional diagrams on the white board use the Graphic sheet in the Instructor Evaluation
section at the end of this book.

.....................................................................................................................................................
10-35
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

.....................................................................................................................................................
10-36 Oracle Designer 6i: Web PL/SQL Design and Generation
Suggested Graphics
.....................................................................................................................................................

Suggested Graphics
Instructor name: Full email:

Course Name:Oracle Designer 6i: Web PL/SQL Design and Generation


Lesson No: 10 Page No:
Please sketch your additional diagram below.

.....................................................................................................................................................
10-37
®
Lesson 10: Completing Your Application
.....................................................................................................................................................

Oracle Designer Education Products


Curriculum Development
520 Oracle Parkway
Thames Valley Park
Reading - Berkshire
England

fold here

.....................................................................................................................................................
10-38 Oracle Designer 6i: Web PL/SQL Design and Generation
A
.................................

Solutions
Appendix A:
.....................................................................................................................................................

Practice 1—1: Solutions


4 How many titles are displayed?
Three titles are displayed:
– GAME - TEKKEN 3 - Test your fighting skills against a new set of
fighters. Great graphics.
– GAME - STREET FIGHTER 10 - Yet another update to this very
popular game. Seven new levels for the more experienced fighters.
– MOVIE - ENEMY OF THE STATE - Will Smith is in the wrong place at
the wrong time.
7 Find all movies. How many times does MOVIE appear in the list of returned titles?
The word MOVIE appears just once.
11 Can you see details for all customers?
No, you can only view/change details for the customer BART.
13 Enter the URL again and select Rent a title. What happens?
The Log on screen appears again.
14 Log on using your own ORA<nn> username and password. What happens?
The log on fails because no customer account exists.
16 Add a new rental. Which customer name appears for the rental?
The rental is created using the name supplied for the ORA<nn> customer.

..........................................................................................................................................................
A-2 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 2—1: Solutions
.....................................................................................................................................................

Practice 2—1: Solutions


3 When the generation process finishes, investigate the generated files:
a How many files are generated?
When you generate a Web PL/SQL module you create three files.
b What are the names of the files?
The names of the files generated for each module follow the pattern
CVW<Module Implementation Name> followed by the file extension.
The files you generated are:
• cvwpersonal.pks
• cvwpersonal.pkb
• cvwpersonal.sql
c What does each file contain?
cvwpersonal.pks contains the package specifications generated for the
module. There is one package specification for the module and two
package specifications for each module component.
cvwpersonal.pkb contains the package bodies generated for the module
There is one package body for the module and two package bodies for
each module component.
cvwpersonal.sql contains an installation script for the module
components.
4 Find out the names of the generated PL/SQL packages.
a What is the name of the module package?
The module package name is the module implementation name followed
by ‘$’. The package for the MEM0010 module is called PERSONAL$.
b What are the names of the module component packages?
The module component packages are formed by concatenating the name
of the module package with the name of the module component. In this
case, the package names are PERSONAL$CUS_MC and
PERSONAL$JS$CUS_MC.

.....................................................................................................................................................
®
A-3
Appendix A:
.....................................................................................................................................................

Practice 2—2: Solutions


3 Look at the titles on the first page. The second line in a large font (Personal
Details) is the title for the module component. What is its subtitle?
Query Form
6 Which field is displayed in red?
Customer ID
7 List the distinct pages that you can see.
Query Form
Record List
View Form

..........................................................................................................................................................
A-4 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 2—3: Solutions
.....................................................................................................................................................

Practice 2—3: Solutions


2 Examine the diagram and answer the following questions:
a What are the names of the module components?
The only module component is called CUS_MC.
b There is no insert form. Why not?
The module component does not have the insert operation available.
c Why does the STREET item not appear on the query form?
The item does not have the query operation available.

.....................................................................................................................................................
®
A-5
Appendix A:
.....................................................................................................................................................

Practice 2—4: Solutions


There is no formal solution for this practice.

..........................................................................................................................................................
A-6 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 3—1: Solutions
.....................................................................................................................................................

Practice 3—1: Solutions


2 Answer the following:
a What are the names of the files?
The files are named from the table short name with the suffixes .pks,
.pkb, and .sql.
b What is the name of the API package?
It is called cg$customers.

.....................................................................................................................................................
®
A-7
Appendix A:
.....................................................................................................................................................

Practice 3—2: Solutions


1 Open the file tk_ref.pdf, which is in the refs folder in your working directory, and
answer the following questions:
a What is the purpose of the HTP package?
It generates standard HTML tags.
b Name the procedure in the HTP package used to display text in italics.
The htp.italic procedure displays text in italics.
c Name the procedure in the HTP package used to display a horizontal line.
The htp.hr procedure outputs a horizontal line.

..........................................................................................................................................................
A-8 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 3—3: Solutions
.....................................................................................................................................................

Practice 3—3: Solutions


1 In the online help, search for WSGL.
a What is the general purpose of the WSGL package?
The WSGL package provides standard HTML functionality for generated
Web applications.
b What is the general purpose of the WSGFL package?
The WSGFL package provides text formatting functionality.
2 In your working directory, open the generated package body file for module
MEM0010 (cvwpersonal.pkb) and answer the following questions:
a How do you know which code relates to the table API?
The table API calls are prefixed with cg$customers.
b Find a line of code that calls the table update procedure.
To find this, search for cg$customers.upd.
c How do you know which code relates to the WSGL?
The WSGL calls are prefixed with wsgl.
3 The Customer Id displays in red when you run the module.
a Can you find the line of code that implements this feature?
Search for wsgfl.red.
b Which Web PL/SQL Generator Library procedure is used to achieve this?
WSGL.LayoutData(WSGFL.red(FORM_VAL.CTR_ID));

.....................................................................................................................................................
®
A-9
Appendix A:
.....................................................................................................................................................

Practice 4—1: Solutions


3 Based on the Short Definition of this function, should the Response be set to
IMMEDIATE (online) or OVERNIGHT (batch)? Set the property if necessary.
The response should be immediate.
7 Does the module currently have module components or table usages?
The module does not yet have module components.
9 Requery the module. What additional information does it now have?
a What are the names of the module components?
The module components are RENTALS and RENTAL_ITEMS.
b How did the utility know to create the table usages?
It created the table usages from the RENT09 function’s entity usages.
14 Can you see any other information that might also be suitable as displayed lookups
for each of the base tables? You add this information in a later lesson.
You can also display the name of the customer for the membership and the
title of the copy.
16 In Display View, put the items in sensible sequences.
RENTALS RENTAL_ITEMS
IDENTIFIER LINE_NO
TRANSACTION_DATE CPY_ID
MBP_IDENTIFIER TTE_PRODUCT_CODE
CURRENT_START_DATE SHELF_CODE
COMPLETED RENTAL_PERIOD
STAFF_REMARKS PRICE
EPE_IDENTIFIER RETURN_DATE
STAFF_REMARKS

18 What operations have been set for the RENTALS module component? Where did
these values come from?
The RENTALS module component has the Insert, Update and Query
operations. It took this information from the entity usages.

..........................................................................................................................................................
A-10 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 4—1: Solutions
.....................................................................................................................................................

20 Generate, install and run REN0010.


The form should look like this.

.....................................................................................................................................................
®
A-11
Appendix A:
.....................................................................................................................................................

Practice 4—2: Solutions


1 What operations do you need for each table and its items?
The MEMBERSHIPS table should allow query, insert and update. The
Identifier cannot be updated, but all other items can default.
The MEMBERSHIP_PERIODS table should only allow query.
3 Create the MEM_MC module component based on the MEMBERSHIPS table (do
not include the CUSTOMERS lookup yet).
c Ensure that only customers are retrieved (not organizations).
Add a Where clause: CTR_ID IS NOT NULL
5 Run the utility to link MEMBERSHIPS and MEMBERSHIP_PERIODS and to
create the CUSTOMERS lookup. Is there anything you should do before running
the Default Links utility to create the lookup?
Before running the utility, add column descriptors for the CUSTOMERS
table.
8 Generate, install and run the module.
The query form should look something like this:

..........................................................................................................................................................
A-12 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 4—2: Solutions
.....................................................................................................................................................

The view form should look something like this:

.....................................................................................................................................................
®
A-13
Appendix A:
.....................................................................................................................................................

Practice 4—3: Solutions


4 Examine the module definition. How many of each were created?

Types of Elements Element Names


Module Components TITLES
Table Usages TITLES
Item Groups Four groups (names start RECT)
Bound Items PRODUCT_CODE MEDIUM
TITLE MINIMUM_MEMORY
PRICE DURATION
TYPE AGE_RATING
MOVIE_CATEGORY MONOCHROME
GAME_CATEGORY AUDIO
DESCRIPTION
Windows WINDOW1

5 What is the purpose of an item group (have a look in the online help if you are
unsure)?
An item group is a collection of items that is treated as a single layout object.
Item groups can be defined within module components and sub-components
and can also be nested within other item groups. Web PL/SQL Generator also
uses item groups to define break groups.

..........................................................................................................................................................
A-14 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 4—3: Solutions
.....................................................................................................................................................

9 Generate, install and run the module.


The view form should look something like this:

a Press the Find button. Why is there only one Title?


The Titles form only displayed one record in each block and this property
has been carried forward.
b Why is the Price Code displayed?
The Price Code is mandatory and the module allows insertion of records.

.....................................................................................................................................................
®
A-15
Appendix A:
.....................................................................................................................................................

Practice 5—1: Solutions


3 Modify the TITLES module component and a preference to display 10 records at a
time.
On the Display tab of the edit module component properties, set the number
of rows displayed to maximum. Set the ZONLRS – Record Set Size
preference to 10.
4 Ensure that the following items appear on the record list: PRODUCT_CODE,
TITLE, GAME_CATEGORY, MOVIE_CATEGORY, PRICE.
Invoke the Properties Palette for the Titles Table Usage. Click on the Context
tab and add the above columns to the Context items box.
You can also change the Context? property for individual bound items. Take
care not to change the ConText option? property by mistake.
5 Set a preference to suppress the record list if only one record is returned.
Set the ZONLSR – Skip record list when query retrieves one record
preference to Yes.
6 Generate, install, and run the module to answer the following questions.
The record list should look something like this:

d Click on the hypertext link for one of the records displayed in the record list.
What information appears at the top of the view form?
The context information from the record list is shown on the view form.

..........................................................................................................................................................
A-16 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 5—1: Solutions
.....................................................................................................................................................

e Go back to the query form and enter GR% into the Product Code as the query
criterion. Which form displays after the query form?
The view form: the record list is suppressed when it contains one record.

.....................................................................................................................................................
®
A-17
Appendix A:
.....................................................................................................................................................

Practice 5—2: Solutions


1 Alter the layout style for the record list to bulleted list. Generate, install, and run
the module.

2 Alter the layout style for the record list to numbered list. Generate, install, and run
the module.

..........................................................................................................................................................
A-18 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 5—3: Solutions
.....................................................................................................................................................

Practice 5—3: Solutions


1 Alter the display style of the module component so that the record list and view
form appear on the same page after a query.
1 Select the module component.
2 Invoke the Edit Module Component dialog.
3 Click on the Display tab.
4 Change the layout style to List/Form.
3 Execute a query:
a What difference do you see?
When the next page appears, it is divided into frames and both the record
list and the view form are visible in the lower part of the screen.
b When do you think this layout is most suitable?
This layout is most suitable when the query and insert forms do not
contain many fields and they can be displayed effectively in a frame.

.....................................................................................................................................................
®
A-19
Appendix A:
.....................................................................................................................................................

Practice 5—4: Solutions


1 Generate, install, and run the module and note the information that is duplicated.
The membership identifiers and the transaction dates are duplicated.
2 Modify the module definition to display the data as a break report, using the
following to assist you:
a Resequence the items to display first those on which you want to break.
Display MBP_IDENTIFIER first, RENTAL_DATE second and RTL_ID third.
Put the displayed items in the following order: MBP_IDENTIFIER,
RENTAL_DATE, RTL_ID.
b Set the ordering sequence for the data so that it matches the display sequence
of the items.
Set the ordering sequence as follows:

Columns Order by sequence

MBP_IDENTIFIER 10
RENTAL_DATE 20
RTL_ID 30

e Generate, install, and run the module. What is the impact of creating break
groups?
The names and dates are only shown on the first row in any group. The
rental number is now the hyperlink to the view form.

..........................................................................................................................................................
A-20 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 5—4: Solutions
.....................................................................................................................................................

3 Modify the module definition to include a count of the number of rentals each
customer has made:
a Create a computed unbound item, NO_OF_RENTALS. What properties
should you set? Complete the table below and use it as a guide when setting the
required properties:

Property Value
Prompt No of Rentals
Unbound Item Type Computed
Reset Level Current group
Reset Group
Derivation Expression COUNT(MBP_IDENTIFIER)

b Place the unbound item in the appropriate item group.


Drag the summary item into the MBP_GP break group.
4 Set a preference to remove the lines on either side of the total.
Set the ZONLSS – Record List: Show computed item separator
preference to No.
The record list should look something like this:

.....................................................................................................................................................
®
A-21
Appendix A:
.....................................................................................................................................................

Practice 6—1: Solutions


1 Use the Design Editor to modify the startup page to look like the following:

a Add the following user text:


In the Edit Module dialog, add the following user text:

User text area Value


Default Area <i>This module enables you to browse through
video and game titles.</i>
Top of First htf.img(‘/webapp/graphics/hollywood.gif’)
Page
Bottom of First htf.small(‘If you have trouble using this page,
Page please email ’||htf.mailto(‘cs@hollywood.com’,
‘Customer Services’)||’.’)

b Set a module level preference to set the background to /webapp/graphics/


background.gif.
In the Document Attributes category, set the MODBGR - Background
Image File preference at the module level to /webapp/graphics/
background.gif.
2 Generate, install, and run the module. If you can see HTML tags, set the
preference that governs whether or not the generator recognizes HTML markups.

..........................................................................................................................................................
A-22 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 6—1: Solutions
.....................................................................................................................................................

In the Text Handling category, set the MODSUB - Substitute HTML


Reserved Characters preference at the module level to No.

.....................................................................................................................................................
®
A-23
Appendix A:
.....................................................................................................................................................

Practice 6—2: Solutions


1 Move the information from the Top of First Page user text area to the standard
header preference in the GENERAL preference set
Cut the text from the Top of First Page user text area and paste it into the
MODSHD – Standard Header preference in the GENERAL preference set.
2 Ensure that the standard header appears at the top of every page.
Set the MODSHA – Standard Header On All Pages preference to Yes in
the GENERAL preference set.
5 The standard footer is created by calling a custom function.
a Use a text editor to look at the code in the file docs/holly_pkg.sql in your
working directory. What are the names of the functions in this file?
There are three functions, called STD_FOOTER, STD_HEADER and
STD_HEADER2.
6 Modify the GENERAL preference set to use the footer function on all pages.
Set the MODSFA – Standard Footer On All Pages preference to Yes in the
GENERAL preference set.
7 Set the standard footer preference to call the STD_FOOTER function from the
HOLLY_HTML package (use <package_name>.<function_name>).
Set the MODSFT – Standard Footer preference to HOLLY_HTML.STD_FOOTER
in the GENERAL preference set.
8 Set a preference to tell the generator that the HOLLY_HTML package exists.
Add the package name, HOLLY_HTML, to the PKGLST – PL/SQL Package List
preference in the GENERAL preference set.
9 View the Generator Preferences for the module REN0020. How can you tell
whether the preferences you have set for the GENERAL preference set have been
applied to the module?
Preferences inherited from the preference set are indicated by the preference
set icon :

..........................................................................................................................................................
A-24 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 6—3: Solutions
.....................................................................................................................................................

Practice 6—3: Solutions


3 In the GENERAL preference set, add /webapp/photos/ as the default image
location.
The photographs are stored in /webapp/photos. Set the IMGIFP – Default
image location preference to specify this directory.
6 Generate, install and run the module to answer these questions:
a Why do the Hollywood logo and the footer appear in this module?
You set the standard header and footer preferences in the GENERAL
preference set which has been set at container level.
b Does the photograph appear on the record list?
The record list should look something like this:

You should be able to click the photograph to reach the view form.
c Can you email a customer by clicking on the email address?
When you click the email address, the New Email Message window pops
up.

.....................................................................................................................................................
®
A-25
Appendix A:
.....................................................................................................................................................

d On the view form, why can you not amend the name of the photograph file?
The view form should look like this:

It does not make sense to allow customers to change the name of the file
(as it is maintained by Hollywood), so it does not have the Update property
set. Because it cannot be updated, it is again displayed as an image and the
user does not see the file name.
e On the view form, why can you amend the email address?
A customer may want to change this information, so it has the Update
property set. Because it can be updated, the column formatting is ignored
and it is not displayed as a hyperlink.
7 Display the record list rows in alphabetical order of the customer’s name.
Set the order by property for the LAST NAME and FIRST NAME bound items.
8 Display fewer rows on the record list.
For the module component, set the number of rows displayed to 3.
9 Remove the table border from the record list.
Set the ZONLBT – Record List: Add Table Border preference to No.

..........................................................................................................................................................
A-26 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 6—4: Solutions
.....................................................................................................................................................

Practice 6—4: Solutions


3 In the Design Editor, set the Document Templates preferences for the MEM0010 -
Maintain Personal Details module. Map the startup page and the record list to
les06.tpl.
Set the DOCTMC – Module Content Template Filename and DOCTRL –
Record List Template Filename preferences, which map to the startup
page and the record list respectively.
4 Generate, install, and run the module to answer the following questions:
a What color is the title text on the startup page and record list?
The title text is olive green.
b What color is the background image on the startup page and record list?
The background image is cyan.
c What color is the title text on the view form?
The title text is blue.
d What color is the background image on the view form?
The background image is mauve with the Designer logo.
5 What do you have to do to change the background image? What would be a more
efficient implementation, with respect to development time?
You must change the template file and then generate and install the module
again. It would be more efficient to use a template that points to a runtime
style sheet.
10 Generate, install, and run the module. Can you see your changes?
You cannot see the changes on the startup page or the record list because
the module level Document Template preferences apply to those pages.
When you navigate to the view form, the title text is olive green and the
background image is cyan.

.....................................................................................................................................................
®
A-27
Appendix A:
.....................................................................................................................................................

Practice 6—5: Solutions


1 Using a text editor, view the contents of the frameset file, frame06.tpl, which is in
the docs folder in your working directory.
a What are the names of the frames?
The frames are called TOP, BOTTOM, LEFT and RIGHT.
3 Set the generator preferences at module level:
Set the preferences in the Frames group.
a Use a custom frameset.
Set the LFCUST – Use Custom Frameset preference to Yes.
b Specify that the query form should be in a frame.
Set the LFQOSP – Place Query Form on Separate Page preference to
No.
4 Map the generated pages to the appropriate frames:
a Specify that you want to use the frame06.tpl file in your working directory.
Set the LFFSTP – Custom Frames: Template Filename preference to
frame06.tpl.
b Set the query form and record list to appear on the left.
Set the LFQFFM – Custom Frames: Query Form Frame and LFRLFM –
Custom Frames: Record List Frame preferences to LEFT.
c Arrange for the insert and view forms to appear on the right.
Set the LFVFFM – Custom Frames: View/Insert Form Frame preference
to RIGHT.
d Map the default text, module content, and header to the top frame.
Set the LFDTFM – Custom Frames: Default Text Frame, LFHDFM –
Custom Frames: Header Frame, and LFMCFM – Custom Frames:
Module Content Frame preferences to TOP.
e Map the footer to the bottom frame.
Set the LFFTFM – Custom Frames: Footer Frame preference to
BOTTOM.
5 Generate, install, and run the module to answer these questions:
a In which frame does the query form appear?
It is in the centre left frame.
b Execute a query. In which frame does the record list appear?
It is in the centre left frame.

..........................................................................................................................................................
A-28 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 6—5: Solutions
.....................................................................................................................................................

c Click on any record. Where does the view form appear?


It is in the centre right frame.
d Click the New button. Where does the insert form appear?
It is in the centre right frame.
6 Remove some of the items from the record list (they are not necessary as you can
see additional information in the view form when you click on the context
hyperlink).
Clear the Context? property from all items except TTE_TYPE and TITLE.
7 Remove the context information from the view form (it is not necessary as the
forms are now all displayed at once).
Set the ZONVCH – View Form: Display Context Header preference to No
Heading.
8 Change the layout of the view form so that the user does not have to scroll down to
see the information.
Set the ZONVTC – View Form: Number of items per line preference to 2.
9 Use break groups to separate movies from games on the record list.
Create two break groups: one for TTE_TYPE and one for all the other items.
The page should look something like this at the end of the practice:

.....................................................................................................................................................
®
A-29
Appendix A:
.....................................................................................................................................................

Practice 7—1: Solutions


1 Generate, install, and run REN0010.
b What would make the record list more useful to the customer?
It needs additional context information, such as the name of the member.
c Is there any information here that the customer should not see?
Arguably, the customer should not see the information relating to
Hollywood’s employees (Employee Identifier and Staff Remarks).
2 Select rental 5015.
a How can you find out which items were rented?
1 Click the Rental Id link to see the Rental Items query form.
2 Execute a query to see the Rental Items record list.
3 Select a record to see the Rental Items view form.
b What changes would make this more usable for the customer?
The customer should not have to execute a query on rental items (each
rental will only have a few items). It would also be helpful if the list of
Rental Items (with contextual information) were to appear on the same
form as the Rental and if it showed information about the rented titles.
c Prevent the customer seeing information related to specific employees.
In the Navigator, ensure that EPE_IDENTIFIER and STAFF_REMARKS
are not displayed or queryable.

..........................................................................................................................................................
A-30 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 7—2: Solutions
.....................................................................................................................................................

Practice 7—2: Solutions


1 Make the changes identified in Practice 7—1.
a Add a chained lookup table usage to the RENTALS module component so that
customers can see their names (rather than their membership number).
Add CUSTOMERS as a lookup table usage to the MEMBERSHIPS
lookup usage. Edit the new lookup usage: select the first and last name
items as display items and context items.
b Add context items to the RENTALS module component so that customers can
see their names, rental dates, and rental numbers on the record list. Ensure that
the names are in the first item group.
In the Navigator, set all displayed items as context items. In Display View,
move the customer’s names into the correct item group.
c Add a chained lookup table usage to the RENTAL_ITEMS module component
so that the customer can see detailed information about the title.
Add TITLES as a lookup table usage to the COPIES lookup usage. Select
the title and description as display items and context items.
d Add context items to the RENTAL_ITEMS module component so that the
customer can see the line number, price, period, and title on the record list.
In the Navigator, set all displayed items as context items.
e Generate, install, and run module REN0010. Check that the customer cannot
see the employee information.
2 Ensure that the Rental Items information appears on the Rentals view form.
a Make all items on the RENTAL_ITEMS module component nonqueryable.
Use the Design Editor Navigator to select all the bound items in module
component RENTAL_ITEMS. Invoke the Property Palette and change
the Query? property to No.

.....................................................................................................................................................
®
A-31
Appendix A:
.....................................................................................................................................................

b Generate, install, and run module REN0010. Navigate to the Rentals view
form. Is the Rental Items record list visible?
Select one of the Rentals records. The detail Record List is now on the
same page as the master View Form.

c What is the advantage of having the detail record list on the same page as the
master view form?
The advantage of this layout is that all the information can be obtained
with one connection to the WebServer and one database session.
d Under what circumstances might you opt to have the detail record list on a
separate page?
– If you have two or more details linked to the same master component,
navigating the module may be clearer if the detail Record Lists appear
on separate pages.
– If you have multiple detail records, you may want to enter query
criteria to restrict the detail records returned.

3 Enable navigation directly to the detail record list from the master record list.
a Find out which generator preference you must alter.
The preference is ZONLDL – Record List: Add detail
hyperlinks to Record List.

..........................................................................................................................................................
A-32 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 7—2: Solutions
.....................................................................................................................................................

c Generate, install, and run module REN0010. What difference do you notice on
the record list of the master component?
A hypertext link to the detail Record List appears on each row in the
master Record List.

d What would you expect to see if module REN0010 had two detail module
components?
Two hypertext links would appear on each row of the master Record List,
each one linking to a different detail Record List.

.....................................................................................................................................................
®
A-33
Appendix A:
.....................................................................................................................................................

Practice 7—3: Solutions


1 Set the appropriate Master Context preference to make the information available.
Use the Generator Preferences Navigator to select the MCNMDP – Master
Context: Maintain context to this depth preference. Set it to 1 at the
module level.
2 Set the Top of Record List user text for the RENTAL_ITEMS module component.
Refer to one or more of the master context items by item name.
Use the Property Dialog to set the user text to a value such as the following:
htf.bold(L_CTR_FIRST_NAME||’ ’||L_CTR_LAST_NAME||
’: ’||RENTAL_DATE)
3 Generate, install, and run module REN0010. You should be able to see your user
text string when you navigate to the Rental Items record list.

..........................................................................................................................................................
A-34 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 7—3: Solutions
.....................................................................................................................................................

4 Click the New button to see the Insert page. Why does the context information not
appear here?
Only the Record List user text has been set.
5 Specify that master context information should be displayed by a display package.
a Set the appropriate Master Context preference to the name of the package
(WSGMC_OUTPUT2).
Use the Generator Preferences Navigator to select the MCNDPK – Master
Context: Display package preference at module level. Set it to
WSGMC_OUTPUT2.
b Set the appropriate Master Context preference to suppress the use of the
package on the Record List.
Use the Generator Preferences Navigator to select the MCNFRM – Master
Context: Forms requiring context preference. Set it to Q.V.I.
6 Generate, install, and run module REN0010. Navigate to the Rental Items insert
page. You should see the Rentals context items at the top of the page with an arrow
showing the link to Rental Items.

.....................................................................................................................................................
®
A-35
Appendix A:
.....................................................................................................................................................

Practice 7—4: Solutions


1 Run the Default Lists of Values utility for the REN0010 module.
a What LOV components are created?
The MBP_LOV component is created for the RENTALS module
component. The CPY_LOV component is created for the
RENTAL_ITEMS module component.
b With which items are the LOV components associated?
The MBP_LOV component is associated with the MBP_IDENTIFIER
item. The CPY_LOV component is associated with the CPY_ID item.
2 Generate, install and run the module.
a Click a name in the record list to see the Rentals view form. Why can you not
see an LOV link here?
The RENTALS module component is not updatable.
4 The list of titles in the CPY_LOV component could be very long. Enable the
customer to enter a condition that reduces the number of titles returned. Generate,
install, and run the module.
1 Invoke the Properties Dialog for the CPY_LOV component association.
2 On the Usage tab, select Filter Before Display?.
5 What problem do you see with this list of titles? Why does it occur?
Some titles appear more than once because Hollywood owns multiple copies
of those titles. Also, some of these copies may be being rented by other
people.
6 Add a restriction to the association for the CPY_LOV component to ensure that
only available titles are returned.
Invoke the Properties Dialog for the CPY_LOV component association. On
the Additional Restriction tab, enter the following SQL condition:
cpy_id not in (select i.cpy_id
from rentals r, rental_items i
where r.rtl_id = i.rtl_id
and r.completed = ’N’)

..........................................................................................................................................................
A-36 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 7—4: Solutions
.....................................................................................................................................................

7 Ensure that each title is returned only once:


c Change the return list on the association to return values into the copy id, the
rental period, the price and the title.
Invoke the Properties Dialog for the CPY_LOV component association.
On the Return List tab, enter the following associations:
RENTAL_ITEMS.RENTAL_PERIOD = CPY_LOV.L_TTE_DEFAULT_DAYS,
RENTAL_ITEMS.PRICE_PAID = CPY_LOV.L_TTE_PRICE ,
RENTAL_ITEMS.CPY_ID = CPY_LOV.FIRST_COPY ,
RENTAL_ITEMS.L_TTE_TITLE = CPY_LOV.L_TTE_TITLE
8 Use the generator preferences to invoke the LOV from a button rather than a
hyperlink. (The lov.gif file in your directory contains a suitable image.)
1 Open the Web PL/SQL Preferences Navigator for the GENERAL preference
set.
2 Navigate to the LOVBUT – List Of Values: Hyperlink preference.
3 Enter the following text to display the image with alternative text and no
border:
HTF.IMG(‘/webapp/graphics/lov.gif‘, null, ‘List of Values‘,
null, ‘border=0‘)

.....................................................................................................................................................
®
A-37
Appendix A:
.....................................................................................................................................................

Practice 7—5: Solutions


3 Click the New button for Rental Items to navigate to the insert form:

..........................................................................................................................................................
A-38 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 7—6: Solutions
.....................................................................................................................................................

Practice 7—6: Solutions


1 Run the module to investigate what happens when you try to insert a new rental
record.
d What happens when you click the Insert button?
The form reports an error because the employee identifier is missing.
2 Set up an appropriate default employee identifier for a new rental.
a In SQL*Plus, look at the EMPLOYEES table and identify the dummy
employee that is to be used for rentals made on the Web.
The dummy employee is number 9999.
3 Generate, install, and run the module. You cannot see the change (the
EPE_IDENTIFIER item is not displayed) but can you now insert a record?
You should see the success page after inserting the record.

.....................................................................................................................................................
®
A-39
Appendix A:
.....................................................................................................................................................

Practice 8—1: Solutions


3 Generate, install and run the module.
b Change one of the field values and attempt to save the changes. Does the alert
display?
The alert should display asking if you want to save your changes.
c Click Cancel in the alert box. Are the changes saved?
The changes should remain on the screen but should not be saved to the
database.
e In the alert dialog, click OK. Are the changes saved?
This time the changes should be saved to the database.

..........................................................................................................................................................
A-40 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 8—2: Solutions
.....................................................................................................................................................

Practice 8—2: Solutions


4 Use the Logic Editor to enter code that calls the named routine.
Enter the following code into the PreInsert event:
Set_Return_Date;
5 Generate and install and run the module.
c Is the return date derived correctly?
Since the LOV returns the rental period, the return date should
automatically be set.

.....................................................................................................................................................
®
A-41
Appendix A:
.....................................................................................................................................................

Practice 8—3: Solutions


1 On the CUS_RMC reusable module component, create a SQL Expression
unbound item called FULL_NAME that concatenates DESIGNATION,
FIRST_NAME and LAST_NAME (the result should be, for example, Dr Evelyne
Bachelet).
Create FULL_NAME against the CUS_RMC reusable module component
using the following expression:
INITCAP(DESIGNATION) || ‘ ‘ || INITCAP(FIRST_NAME) || ‘ ‘ ||
UPPER (OTHER_INITIALS) || ‘ ‘ || INITCAP(LAST_NAME)
5 Has FULL_NAME been updated to reflect the change? If not, why not?
FULL_NAME should remain unchanged as the expression is derived on the
server. The changes must be saved to the database before FULL_NAME can
be updated.
6 In the Design Editor and set the required preference in the GENERAL preference
set to derive expressions in the client.
Select the GENERAL preference set and set the ZONVEC – View Form:
Derive Expressions In Client preference to Yes.
9 Has FULL_NAME been updated to reflect the change? Why?
FULL_NAME is updated as soon as DESIGNATION, FIRST_NAME or
LAST_NAME is changed as the expression is now derived in the client.

..........................................................................................................................................................
A-42 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 9—1: Solutions
.....................................................................................................................................................

Practice 9—1: Solutions


5 Use the Build Actions window to inspect the code for the package body. Where
does the argument Z_TTE_TYPE appear?
The argument appears as a parameter to the startup procedure.
7 Click the Find button. What type of records appear in the record list?
Only movie titles appear in the record list.
8 Click the Query button. Enter COUNTDOWN into the Title field. What is the
result?
The record is not retrieved because it is a game and so the type is incorrect.
9 For the module, set the Security category of Generator preferences to:
a Force the calculation of checksums.
Set the SECECS – Enforce URL Checksums preference to Yes.
b Force lowercase URLs.
Set the SECEUC - Force lower case URL preference to Yes.
10 Generate and install the module. Run the module by entering the following URL.
What happens?
You get an error message. Access is denied.
11 What happens when you enter the following URL?
You get an error page that reports an invalid argument for the procedure.
13 Navigate to the view form for customer 150. What value is displayed in the URL?
The URL is similar to the following:
.../personal$cus_rmc.QueryViewByKey?P_CTR_ID=150&Z_CHK=37602
14 Edit the URL. Change the value of P_CTR_ID to 152. What happens?
You get an error message. Access is denied.

.....................................................................................................................................................
®
A-43
Appendix A:
.....................................................................................................................................................

Practice 9—2: Solutions


3 Generate, install and run the module.
The registration form should look like this:

b What problem is there?


Once you enter a valid username and password, you can access the records
for any customer.
4 Create an argument for the module to ensure that a user can only query the
customer record that corresponds to the entered username and password.
a Create an argument, Z_CTR_ID.
b Set the auto-query property for the CUS_RMC reusable module component.
c Clear the query property for all the items on the CUS_RMC reusable module
component.
d Suppress the record list (only one row will be returned from the query) by
setting the ZONLSR – Skip record list if query retrieves one row
preference to Yes.

..........................................................................................................................................................
A-44 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 10—1: Solutions
.....................................................................................................................................................

Practice 10—1: Solutions


3 Generate, install, and run the module.
The form should look like this:

.....................................................................................................................................................
®
A-45
Appendix A:
.....................................................................................................................................................

Practice 10—2: Solutions


3 Link the menu modules to the launch page module
REN0001.
The REN0001 module diagram should look like this:

4 Generate, install, and run module REN0001.


The form should look like this:

..........................................................................................................................................................
A-46 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 10—2: Solutions
.....................................................................................................................................................

5 What effect do the menu modules have on the appearance of module REN0001?
The menu modules appear in a bulleted list.
6 How would you display the short form of the menu title?
Set the module-level preference, MODMNS - Menu Style to SHORT TITLE.

.....................................................................................................................................................
®
A-47
Appendix A:
.....................................................................................................................................................

Practice 10—3: Solutions


3 Generate, install and run the module.
The form should look something like this:

4 Use the GENERAL preference set to place a link to the online help module from all
pages of all modules in the application (except module HLP0010 itself).
For the HLP0010 module, set the MODSHD – Standard Header preference
explicitly to the current value:
htf.img(‘/webapp/graphics/hollywood.gif’)
In the GENERAL preference set, add the following code to the MODSHD –
Standard Header preference:
&nbsp;&nbsp;&nbsp;&nbsp;
htf.anchor(‘http://<server>/<agent>/holly_help$.startup’,’Help’)

..........................................................................................................................................................
A-48 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 10—3: Solutions
.....................................................................................................................................................

6 Generate, install and run REN0001.


The form should look like this:

.....................................................................................................................................................
®
A-49
Appendix A:
.....................................................................................................................................................

Practice 10—4: Solutions


3 What appears on the module Startup Page now?
Links to each functional module appear beneath the menu modules:

..........................................................................................................................................................
A-50 Oracle Designer 6i: Web PL/SQL Design and Generation
Practice 10—5: Solutions
.....................................................................................................................................................

Practice 10—5: Solutions


At the end of the practice, the launch module should look like this:

The REN0020 module should look something like this:

.....................................................................................................................................................
®
A-51
Appendix A:
.....................................................................................................................................................

..........................................................................................................................................................
A-52 Oracle Designer 6i: Web PL/SQL Design and Generation
Index
..........................................................................................................................................

Index event 8-11


column display properties 4-5–4-6
Column Values
Symbols formatting 6-12
.pkb file 2-9, 3-13 Context Items 5-8
.pks file 2-9, 3-13 control user input
.sql file 2-9, 3-13 allowable values 7-22–7-24
LOV 7-22–7-24
pop-up calendars 7-22–7-24
A Custom Frameset
About Page 5-6 invoking 6-24
API using 6-22
see Table API Custom Functions
applet 8-22–8-26 writing 6-10, 8-26
application
distributed 10-18 D
installation 2-10
running 2-11, 2-12 Data Design
application design generate and install 3-14
automated 4-5–4-7, 4-8 Database Design Transformer 4-4
manual 4-5–4-7, 4-15 database objects
semi-automated 4-5–4-7, 4-13 define 4-4
Application Design Transformer 4-2, 4- DDT
7, 4-15 see Database Design Transformer
application logic Declarations 8-8
generated 8-4 Default Links utility 4-11
library 8-4 define
modified 8-4 database objects 4-4
network considerations 8-5 frame size 6-21
Applications Programmatic Interface Definitions
see Table API Web Application Server 1-10
Web server 1-10
WebServer Generator 1-12
B Deleting a record 5-11
break group 5-18 descriptors 4-12
Design Capture utility 4-19
Design Editor 4-8, 4-15, 6-5
C display properties
Calculation column 4-5–4-6
client-side 8-18 Display styles
server-side 8-19 exploring 5-14
cascading style sheet 6-18 list style 5-15
check Distributed Modules
function definitions 4-4 creating links 10-18
Check List
pre-generation 3-14
Code Segment

..........................................................................................................................................
®
Index-1
Index
..........................................................................................................................................

E associate a module
with a business function 4-13
entity definitions
copy a reusable module component
transform 4-4
2-15
Event
create a group summary item 5-19
client-side 8-9
create a launch page 10-6
Code Segment 8-6
create a placeholder module
code segment 8-11
JavaScript 8-9 for a web page 10-15
pseudo PL/SQL 8-7 create a view form
server-side 8-7 multi-row DML 7-20, 7-21
event code 8-6–8-11 create a Web Module
from a form 4-19
create computed unbound items 5-19
F create data usages 4-14
Frame size create GUI display items 7-22
defining 6-21 create lookup links
Frames 6-20 using the diagram 4-10
naming 6-23 create master-detail links
Frameset using the diagram 4-9
custom create module level summaries 5-19
using 6-22 define a named routine 8-15
default define an event code segment 8-11
preferences 6-20 generate graphic hotspots 6-13
nesting 6-23 generate the module network 10-17
function definitions include list of values
check 4-4 in a module 7-14
with no association 7-14
install a module after generation 2-10
G install a module manually 2-10
generate invoke the Logic Editor 8-12
Data Design 3-14 run the application after generation
Table API 3-14 2-11
Generation use custom PL/SQL packages 8-8
preparing 3-5 use module arguments 9-4
Generator HTF 6-9
Preferences 2-8 HTML
graphic hotspots see HyperText Markup Language
generate 6-13 HTML tags 6-7
GUI Display Items HTP 6-9
display order 7-22 hyperlink
optional items 7-22 About Page 5-6
suggestion lists 7-22 hyperlinks 10-12
hypertext link 10-10
HyperText Markup Language 6-7
H
how to

..........................................................................................................................................
Index-2 Oracle Designer 6i: Web PL/SQL Design and Generation
Index
..........................................................................................................................................

I component usages 7-10


define using module diagram 7-12,
Image files
7-14
background 6-11
inclusion 7-10, 7-14
Insert Form 5-12
List/ Form style 5-16
install
Logic Editor 8-12
Data Design 3-14
Construct Tree 8-12
Table API 3-14
Edit Window 8-13
Web PL/SQL Generator Library 3-8
LOV 6-25
Web PL/SQL Toolkit 3-14
see list of values
WSGL 3-14
LOVFWD 6-20
items
LOVSTL 6-25
action 8-17
context 5-8
unbound 8-17 M
mapping
J style sheets 6-19
Virtual Directories 6-11
Java 8-22–8-26
Master context information 7-8–7-9
JavaScript or PL/SQL? 8-5
Master Detail record lists 7-4–7-7
Master-detail Navigation 7-6
L Master-detail structure 7-4
Menu Style 10-11, 10-12
Launch Page 10-5 Menu system 10-11, 10-12
creating module 10-5, 10-6 Message Window 2-7
LFCOLS 6-20 MODALR 10-5
LFDTFM 6-24 MODMNS 10-11
LFFTFM 6-25 MODSFH 6-20
LFHDFM 6-25 Module
LFLVFM 6-25 Connectivity 10-9
LFMCFM 6-24 generation 4-18–4-19
LFQFFM 6-24 Language 4-18
LFRLFM 6-24 linking 10-10
LFROWS 6-20 Menu 10-7
LFVFFM 6-24 Network 10-8
Library Network Viewer 10-9
Web PL/SQL Generator 3-8 pages 2-13
install 3-8 structure 2-14
link title 10-11, 10-12
hypertext 10-10 Type 4-18
screen modules 10-10 module
linking table usages 4-9–4-12 automatic installation 2-10
Links creation 4-15
distributed modules 10-18 manual installation 2-10
external WWW pages 10-15 module component
list of values 7-10–7-17 properties 4-17
association 7-10 module component pages 5-7–5-16

..........................................................................................................................................
®
Index-3
Index
..........................................................................................................................................

Module Definition 2-8 executing 5-7


Module Diagrammer Query Form 5-7
data view 2-14 suppressing 5-7
display view 2-14
Module Network 2-8
generating 10-17 R
installing 10-19 record list 5-8
multiple records 7-20–7-21 automatic updates 5-9
multi-row DML break group 5-18
create view form 7-20, 7-21 navigating 5-9
summary item 5-19
Repeating Module
N
results 10-14
Named Routines Repository Object Navigator 4-7
calling 8-14 Reusable components 7-7
defining 8-15 Reusable module components 2-15
server-side 8-16 RON
Naming see Repository Object Navigator
frames 6-23
navigating the record list 5-9
Nesting Frameset 6-23 S
screen module
linking 10-10
O
Screen modules
Oracle Designer 1-12 no data usage 10-5
curriculum 1-4, 1-5 Security
Repository 1-12 API 9-10
authentication 9-7
authorized 9-10
P implementing 9-11
packages basic authentication 9-7
WSGL 3-9 checksums 9-6, 9-18, A-43
PL/SQL packages database authentication 9-7
declaring custom 8-8 digest authentication 9-7
practice application domain restriction 9-8
Hollywood 1-17 forcing authentication 9-9
preferences implementing with packages 9-10
in summary items 5-20 IP address restriction 9-8
procedures restricting module access 9-4
WSGL 3-9 restriction
property domain 9-8
unbound type 5-19 IP address 9-8
using 9-8
Q self-service 9-12
implementing 9-13
Query using authentication 9-7
entering new 5-9

..........................................................................................................................................
Index-4 Oracle Designer 6i: Web PL/SQL Design and Generation
Index
..........................................................................................................................................

security issues defining 6-5


web pages 9-3 embedding HTML 6-9, 6-10
Segment universal generation 6-4
event code 8-11 utility
Single record Default Links 4-11
viewing details 5-9 Design Capture 4-19
Standard Headers and Footers 6-14 Generate Table API 3-12
summary items
include preferences 5-20
V
View Form 5-10
T
Virtual Directories
Table API 3-10–3-13 mapping 6-11
generate and install 3-14
table usage 4-9–4-12
Table Usages 4-19 W
Template Web page
custom 6-16 external
background 6-17, 6-19 linking 10-16
fonts 6-17, 6-19 Web PL/SQL
text 6-17, 6-19 Developer’s Toolkit 1-12
Templates 6-16–6-19 Generator Library Package 1-12
tool Web PL/SQL Generator 8-6
Database Design Transformer 4-4 invoking 2-6
Design Editor 1-12, 4-8, 10-8 Web PL/SQL Generator Library 3-8
Module Diagrammer 2-14 Web PL/SQL Generator Options 2-4
Module Network Viewer 10-8 Web PL/SQL Toolkit 3-6
Repository Object Navigator 4-7 install 3-14
Web PL/SQL Generator 3-8 WebServer Generator
Toolkit 6-9 menu module 10-4
Web PL/SQL 3-6 screen module 10-4
transform WebServer Module
entity definitions 4-4 menu 10-4
screen 10-4
WHERE Clause 7-18
U WSGFL 3-9
Unbound Item WSGJSL 3-9
client-side function 8-21 WSGL
custom 8-21 install 3-14
server-side function 8-20 packages 3-9
SQL expression 8-18 procedures 3-9
unbound type property 5-19 see Web PL/SQL Generator Library
Universal Generation 4-20 see Web PL/SQL Generator Library
Updating a record 5-10 Package
User Inputs WSGLM 3-9
controlling 7-22 WSGOCOL 3-9
User Text 6-4–6-10

..........................................................................................................................................
®
Index-5
Index
..........................................................................................................................................

..........................................................................................................................................
Index-6 Oracle Designer 6i: Web PL/SQL Design and Generation

You might also like