 |
|
Oracle Tips by Burleson |
Application Page Reuse
When developing a large system in HTML DB, it is
imperative to have the ability to invoke a page, or set of pages,
within another application and return without losing the session state
of the calling routine. Having several small applications makes
deployment easier since each application could be enhanced
individually and deployed to the user community. Since an application
page from one application cannot simply be dynamically included for
reusability, some custom navigation will have to be performed.
Having standard shared application pages can
simplify building large HTML DB applications. For example, a large
system may have a standard application page to lookup a person, such
as an employee or customer. This application would be part of a
General, or Global, application to be used by several other
applications. The ability to re-use HTML DB code application pages
across application is critical for many reasons:
-
Reduces developer effort: The ability to create
reusable components reduces coding overhead, and there is never any
need to reinvent the wheel and re-write a common routine.
-
Adds screen uniformity: Shared components reduce
end user training and provide a recognizable standard for shared
system functions.
-
Simplifies maintenance: When a change to a
shared component is made, the change will be immediately available
to all calling components without any code changes.
The following example shows how to create a
cross-application reusable subroutine page in HTML DB. This example
interfaces a page in another application to access and return from a
shared person lookup HTML DB page.
Step 1: Setup the
Re-usable Application Page
The shared page needs to receive the application
id, APP_ID, and application page, APP_PAGE_ID, into some hidden page
items. These page item values will be used by the re-usable page to
know where to navigate back.
In this case, there is an application with a
report region of persons. On that application page, it is necessary
to create two page level items to store the values of the calling
application id, P200_FROM_APP_ID, and the calling page id,
P200_FROM_PAGE. It is also necessary to provide a link in the report
to navigate back to the calling application.
This has created two hidden page items:
-
P200_FROM_APP_ID
-
P200_FROM_PAGE
On the report region, the Full Name field, shown
in Figure 16.2, must be converted into a link field.
From the Report Attributes page, click on the icon
to the left of the FULL_NAME column as shown in Figure 16.3.
On the Column Attributes page, scroll down to the
column link section to modify the properties for the link. Figure
16.4 shows the following in the URL text:
-
P200_FROM_APP_ID and P200_FROM_PAGE are being
used to navigate back to the calling application.
-
The same session id is used by implementing
&SESSION. It is important to navigate using the same session.
Otherwise, all the session state setup thus far will be lost.
-
The application item, global variable, will be
set to the value of the PERSON_ID column.
Step 2: Setup the
Calling Application
There needs to be a page item for the returned
values from the reusable application page. To make this process
simple, create an application level item by the name of G_PERSON_ID.
The application item will be used by page process later.
Step 3: Setup the
Calling Application Page
There are few things that have to be created to
provide navigation to the Global application page and keep track of
the fact this has been done:
-
:
To hold a value indicating a specific function has been initiated.
-
:
To submit the page with the request FIND_PERSON
-
:
To navigate to the global application and set the appropriate page
items.
-
:
To set a page item, that can also be an application item to the
function being performed.
-
: To populate the page with data when the
application returns.
The
above book excerpt is from:
Easy HTML-DB
Oracle Application Express
Create Dynamic
Web Pages with OAE
ISBN 0-9761573-1-4
Michael Cunningham & Kent Crotty
http://www.rampant-books.com/book_2005_2_html_db.htm
 |
For more details and scripts, see my new book "
Oracle
Tuning: The Definitive Reference", over 900 pages
of BC's favorite tuning tips & scripts.
You can buy it direct from the publisher for 30%-off and get
instant access to the code depot. |
|