Tải bản đầy đủ (.pdf) (344 trang)

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

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (5.08 MB, 344 trang )

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

Volume 1 • Student Guide
Course Code: 20007GC10
Prod:1.0
Date: Sep 2000
M012918
Authors
Gillian Channer
Shena Deuchars
Technical Contributors
and Reviewers
Jeffrey Gallus
Satyajit Ranganathan
Gerard Sugrue
Publishers
Fiona Simpson
Carol Brown
Don Griffin
Copyright  Oracle Corporation, 1998, 1999, 2000. All rights reserved.
This documentation contains proprietary information of Oracle Corporation. It is
provided under a license agreement containing restrictions on use and disclosure
and is also protected by copyright law. Reverse engineering of the software is
prohibited. 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:
Restricted Rights Legend
Use, duplication or disclosure by the Government is subject to restrictions for
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
252.227-7013, Rights in Technical Data and Computer Software (October 1988).
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.
If this documentation is delivered to a U.S. Government Agency not within the
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).
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.

iii
®

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
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

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

Contents

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
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
Practice 4—3: Creating a Web Module from a Captured Form 4-25

Hints 4-28
Lesson 5: Changing the User Interface
Introduction 5-2
Review of the Module Structure 5-4
Module Pages 5-5

v
®

Contents
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
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
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

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

Contents
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
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

vii
®

Contents
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
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
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

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

Contents
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
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

Introduction
1

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

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.
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-5
Course Objectives
Use Oracle Designer to:
• Design and build a complete
Web PL/SQL application
• Implement and enforce
company standards
• Implement security
Browser:
http://

1-3

Introduction
®
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.
Applications for the Course 17
Practice 1—1: Browsing a Generated Application 18
Topic See Page

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

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.
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-6
Learning Oracle Designer
First Class
• Learn the tools
• Recognize theory
• Play simple pieces
C
o
m
p
l
e
t
e
d
Focus Courses
• Learn technique
• Understand and
apply theory
• Play complex
pieces
Experience
• Master tools,
technique, and
theory
• Make music!

1-5

The Oracle Designer Curriculum

®
The Oracle Designer Curriculum
In the focus courses you learn more about Oracle Designer.
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-7
Oracle Designer Curriculum
Systems
Modeling
Server Design
& Generation
Web PL/SQL
Design &
Generation
First
Class
Form Design
& Generation

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


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.
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-9
Oracle Designer
Oracle Designer
First Class
First Class
Curriculum Path
Oracle Designer
Oracle Designer
Server Design
Server Design
and Generation
and Generation
Oracle Designer R2:
Oracle Designer R2:
Forms Design
Forms Design
and Generation
and Generation
Oracle Designer

Oracle Designer
Web PL/SQL Design and
Web PL/SQL Design and
Generation
Generation
Managing Development
Managing Development
Using Oracle Repository
Using Oracle Repository
Oracle Designer
Oracle Designer
New Features
New Features
Data Modeling
Data Modeling
and
and
Relational Database Design
Relational Database Design
Oracle Designer
Oracle Designer
Systems Modeling
Systems Modeling
Oracle Designer
Oracle Designer
Forms Design
Forms Design
and Generation
and Generation


1-7

System Building
®
System Building
Developing an entire system is a daunting task, even for experienced application
developers.
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-10
Building Systems that Work
I need a recipe
that tells me
… what to do
…and a tool that
automates the
process.
…and how to do it

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

Lesson 1: Introduction
Methods, Techniques, and CASE Tools

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-11
An Approach to Building Systems
Tools
Method
What do you do?
How do you do it?
Can you automate it?
CDM
Techniques
• Process modeling
• Table Design
• Denormalization

. . .

1-9

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.
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-12
System Development in Context
Analyze
Design
Business Requirements
Application
Process
Business Requirements
Information
Build

Browser:
http://

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

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.
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-13
The Technology We Use
Oracle Designer Web PL/SQL Generator
WebDB
WebDB

1-11


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.
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-14

J
a
v
a

1

.
1
.
2


Three-Tier Architecture
Browser Web server
First tier
Third tier
J
a
v
a

1
.
1
.
2


Database
Second tier

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

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.
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-15
The Oracle Web PL/SQL Generator
Module design
specification
Web PL/SQL
Generator
8
Web server
Dynamic HTML
pages
Requests

Web client

1-13

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.
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-16
Choosing a Web Implementation

Web Pages
with HTML
Oracle Developer
Application
Oracle Web PL/SQL
Generator
Oracle Forms
Generator
Web Browser Workstation
Developer on the Web
Java applet
Runform
Developer
Web Pages

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

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-15

Course Agenda
®
Course Agenda
1-17
Course Agenda

Introduction
• Generating Web PL/SQL Modules
• Setting up the Generation Environment
• Designing Web PL/SQL Modules
Day 1
1-18
Course Agenda

Changing the User Interface
• Implementing User Interface Standards
• Building More Complex Modules
Day 2

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

Lesson 1: Introduction
1-19
Course Agenda

Defining Application Logic
• Using the Web PL/SQL Security API

• Completing Your Application
Day 3

1-17

Applications for the Course
®
Applications for the Course
The guided practices are based on a fictional video rental company named Hollywood.
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-20
The Practice Application

A fictional e-commerce site
• Customers can:
– Change membership information
– Browse through available titles
– Rent titles

×