Skip Headers
Oracle® HTML DB User's Guide
Release 1.6

Part Number B14303-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

6 Application Builder Concepts

This section provides basic conceptual information about Application Builder. Application Builder is the core component within Oracle HTML DB that enables you to build database centric Web applications.

This section contains the following topics:

About the Workspace Home Page

When you log in to Oracle HTML DB, a Workspace home page appears. A workspace is shared work area within the Oracle HTML DB development environment where multiple developers can create applications.

Figure 6-1 Workspace Home Page

Description of htmldb.gif follows
Description of the illustration htmldb.gif

As shown in Figure 6-1, your user name displays in the upper left corner of the page, directly above the workspace name. Three large icons (Application Builder, SQL Workshop, Data Workshop) appear next followed by a list of current applications.

The right side of the page contains two lists:


See Also:

"About the Workspace Administration List" for more information on using the Workspace Administration list

What is Application Builder?

In Oracle HTML DB you use Application Builder to build dynamically rendered applications. Each application is a collection of pages linked together using tabs, buttons, or hypertext links.

To access Application Builder:

  1. Log in to Oracle HTML DB.

    The Workspace home page appears.

  2. To access Application Builder, you can either:

    • Select an application name from the Applications list

    • Create a new application by clicking Create Application

    Application Builder appears.

What is a Page?

A page is the basic building block of an application. When you build an application in Application Builder, you create pages that contain user interface elements, such tabs, lists, buttons, items, and regions. Figure 6-2 illustrates the use of some of these elements in a running application.

Figure 6-2 Sample Application

Description of sampl_app.gif follows
Description of the illustration sampl_app.gif

You add components and layout controls to a page on the Page Definition.

To view the Page Definition of an existing page:

  1. On the Workspace home page, select an application name from the Applications list.

    Application Builder appears. A list of pages appears at the bottom of the page.

  2. To edit a specific page, select a page name, or enter the page number in the Find field and click Go.

    The Page Definition appears. (See Figure 6-3.)

    Figure 6-3 Page Definition

    Description of pg_def.gif follows
    Description of the illustration pg_def.gif

    The Page Definition is divided into three sections:

    • Page Rendering

    • Page Processing

    • Shared Components

    The left section, Page Rendering, lists user interface controls and logic execute when the page is rendered. The middle section, Page Processing, lists logic controls (such as computations and processes) that are evaluated and executed when the page is processed. The far right section, Shared Components, lists common components that display on every page within the application.

About Page Rendering

The following list briefly describes Page Rendering controls:

  • Regions. A region is an area of a page that uses a specific template to generate HTML content. Each page can have any number of regions. You can use regions to group other controls, such as buttons and items. You can create simple regions that do not generate additional HTML, or create elaborate regions that frame content within HTML tables or images. The HTML DB engine displays regions in sequence within columns. You can choose whether a region displays conditionally.

  • Buttons. Buttons are used to submit a page. When you submit a page, the HTML DB engine processes it, or redirects users to another page without any processing. A button can be implemented as an HTML button, an image, or by using a template.

  • Items. Lists the items grouped by region. Items are HTML form elements such as text fields, select lists and check boxes with an associated session state.

  • Computations. Lists the computations that are executed at the time the page is rendered. Computations are units of logic used to assign session state to items.

  • Processes. Lists the processes that are executed at the time the page is rendered. Processes are logic controls used to execute data manipulation language (DML) or PL/SQL. For example, you can use a process to populate session state at the time the page is rendered.

About Page Processing

The following list describes Page Processing controls:

  • Computations. Lists the computations that are executed at the time the page is processed. Computations are units of logic used to assign session state to items.

  • Validations. Enables you to create logic controls to verify whether user input is valid. For example, a validation can check whether a value has been typed into a mandatory field.

  • Processes. Lists the processes that are executed after the page is submitted. Processes are logic controls used to execute data manipulation language (DML) or PL/SQL.

  • Branching. Enables you to create logic controls that determine how the user navigates through the application.

About Shared Components

Shared components are common elements that can display on every page within an application. Examples of shared layout controls include:

Lists

A list is a collection of links that is rendered using a template. For each list entry, you specify display text, a target URL, and other attributes that control when and how the list entry displays. You control the display of the list and the appearance of all list entries by linking it to a template.


See Also:

"Creating Lists"

Lists of Values

A list of values (LOV) is a static or dynamic definition used to display a specific type of page item, such as a radio group, check box, or select list. LOVs can be static (that is, based on a set of predefined display and return values) or dynamic (based on SQL queries that select values from tables).

You define LOVs at the application level by running the LOV Wizard and adding them to the Named List of Values repository.

Menus

A menu is a hierarchical list of links that is rendered using a template. For example, you can display menus as a list of links or as a breadcrumb path.


See Also:

"Creating Menus"

Navigation Bars

Use navigation bars to link users to various pages within an application. Typically navigation bars are used to enable users to log in and log out or link to help text. The location of a navigation bar depends upon the associated page template. A navigation bar icon enables you to display a link from an image or text. When you create a navigation bar icon you can specify an image name, text, a display sequence, and a target location (a URL or page).


See Also:

"Creating a Navigation Bar" for more information on creating navigation bars

Tabs

Tabs are an effective way to navigate users between pages of an application. Application Builder includes two different types of tabs: standard tabs and parent tabs

An application having only one level of tabs uses a standard tab set. A standard tab set is associated with a specific page. You can use standard tabs to link users to other pages within your application. A parent tab set functions as a container to hold a group of standard tabs. Parent tabs give users another level of navigation as well as a context (or sense of place) within the application.


See Also:

"Creating Tabs"

Templates

Templates control the look and feel of the pages in your application. As you create your application you specify templates for pages, regions, reports, lists, labels, menus, buttons, and popup list of values. Groups of templates are organized into named collections called themes.

How Page Processing and Page Rendering Work

When you create an application in Oracle HTML DB, you link pages together using tabs, buttons, or hypertext links. Each page can have buttons and items and can include application logic. You can branch from one page to the next using conditional navigation, perform calculations, validations, and display reports, calendars, and charts. You can generate reports, charts, and forms using built-in wizards, static HTML, or deliver more custom rendering with PL/SQL programming.

The HTML DB engine dynamically renders and process pages based on data stored in database tables. To view a rendered version of your application, you run or submit it to the HTML DB engine. When you run an application, the HTML DB engine relies on two processes:

When you call a page using a URL, the HTML DB engine is running the Show page or page rendering process. When you submit a page, the HTML DB engine saves the submitted values in the session cache and then performs any computations, validations, or processes.

Understanding Conditional Rendering and Processing

A condition is a small unit of logic that helps you control the display of regions, items, buttons, and tabs as well the execution of processes, computations, and validations. For example, when you apply a condition to a button, the rendering engine evaluates the condition during the rendering (or Show page) process. Whether the condition passes or fails determines whether the page control (such as a button) displays.

You specify a condition by selecting a condition type when you create the control or component (for example, the region, item, button, or tab) or by making a selection from the conditional display attribute. (See Figure 6-4.) The condition evaluates to true or false based on the values you enter in the Expression fields.

Figure 6-4 Conditional Display Attribute

Description of condition.gif follows
Description of the illustration condition.gif

To view a complete listing of all available conditions for a given component or control click the View icon to the right of the Condition Type list. Shortcuts to common selections appear directly beneath the list. If your condition requires an expression, type it in the appropriate field.

The sections that follow offer examples of some commonly used condition types.


See Also:

Appendix A, "Available Conditions" for a detailed listing of condition types available in Oracle HTML DB

Current Page In Expression 1

Current page = Expression 1 evaluates to true if the current page matches the page number listed in the Expression 1 field. For example:

100,101,102

If the current page is 100, 101, or 102, then this condition evaluates to true and the condition passes.

Exists

Exists (SQL query returns at least one row) is expressed as a SQL query. If the query returns at least one row, then the condition evaluates as true. For example:

SELECT 1 FROM emp WHERE deptno = :P101_DEPTNO

This example references item P101_DEPTNO as a bind variable. You can use bind variables within application processes and SQL query regions to reference item session state. If one or more employees are in the department identified by the value of P101_DEPTNO, then the condition evaluates as true.


See Also:

"About Bind Variables" for more information

PLSQL Expression

Use PL/SQL Expression to specify an expression in valid PL/SQL syntax that evaluates to true or false. For example:

NVL(:MY_ITEM,'NO') = 'YES'

If the value of :MY_ITEM is YES, then the condition evaluates as true. Otherwise it evaluates as false.

Verifying User Identity

Authentication is the process of establishing users' identities before they can access an application. Authentication may require a user enter a username and password or may involve the use of a digital certificate or a secure key.

Oracle HTML DB supports modular authentication, making it easy to switch authentication methods when needed. You can establish a user's identity by selecting from a number of built-in authentication methods, or by using a wizard to create your own custom authentication approach.

Controlling Access to Controls and Components

While conditions control the rendering and processing of specific controls or components on a page, authorization schemes control user access. Authorization is a broad term for controlling access to resources based on user privileges.

Authorization schemes extend the security of your application's authentication scheme. You can specify an authorization scheme for an entire application, a page, or specific page control such as a region, item, or button. For example, you could use an authorization scheme to selectively determine which tabs, regions, or navigations bars a user sees.

Understanding Session State Management

HTTP, the protocol over which HTML pages are most often delivered, is a stateless protocol. A Web browser is only connected to the server for as long as it takes to download a complete page. In addition, each page request is treated by the server as an independent event, unrelated to any page requests that have happened previously or may occur in the future. This means that to access form values entered on one page on a subsequent page, some form of session state management needs to occur. Typically, when a user enters values into a form on one page, those values are not accessible on later pages. Oracle HTML DB transparently maintains session state and provides developers with the ability to get and set session state values from any page in the application.

A session is a logical construct that establishes persistence (or stateful behavior) across page views. Each session is assigned a unique identifier within the Oracle HTML DB installation. The HTML DB engine uses this identifier (or session ID) to store and retrieve an application's working set of data (or session state) before and after each page view.

Because sessions are entirely independent of one another, any number of sessions can exist in the database at the same time. Since sessions persist in the database until purged by an administrator, a user can return to an old session and continue running an application long after first launching it. A user can also run multiple instances of an application simultaneously in different browser sessions.

Oracle HTML DB sessions are logically and physically distinct from the Oracle database sessions used to service page requests. A user runs an application in a single Oracle HTML DB session from log in to log out with a typical duration measured in minutes or hours. Each page requested during that session results in the HTML DB engine creating or reusing an Oracle database session to access database resources. Each of these sessions lasts just a fraction of a second.

Understanding Session IDs

The HTML DB engine establishes the identity (or anonymity) of the user for each page request and the session ID in order to fetch session state from the database. The most visible location of the session ID is in the URL for a page request. Another visible location is in the page's HTML POST structures or in a session cookie sent by the HTML DB engine during authentication and maintained for the life of the application (or browser) session.

Oracle HTML DB assigns new session IDs during authentication processing, records the authenticated user's identity with the session ID, and continually checks the session ID in each page request's URL or POST data with the session cookie and the session record in the database. These checks provide users with both flexibility and security.

While the session ID is the key to session state, the session cookie (where applicable) and the session record safeguard the integrity of the session ID and the authentication status of the user.

Viewing Session State

The behavior of an HTML DB application is usually driven by values in session state. For example, a button may display conditionally based on the value of an item session state. You can view the session state for a page by clicking Session on the Developer toolbar.

Figure 6-5 Developer Toolbar

Description of d_toolbar.gif follows
Description of the illustration d_toolbar.gif

The Session State page provides valuable information about the page. Table 6-1 describes the various types of information available on the Session State page.

Table 6-1 Information Available on the Session State Page

Heading Description
Application Environment Identifies the session ID, current user, security ID, and browser language.
Application Items Application items are items that do not reside on a page. Application items are session state variables without the associated user interface properties.

See Also: "Using Substitution Strings" for more information on referencing item values

Application, Page, Session Identifies the application name, page number, and session ID.
Page Items Identify attributes of the page, including the item name, how the item displays (hidden, popup, button, display only HTML), the state or session ID, and status.

The Status column indicates the status of the session state. Available values include:

  • I - Inserted

  • U - Updated

  • R - Reset

Session State Indicates the user's entire session state. The section at the top indicates the state for the current page.


See Also:

"Using the Developer Toolbar" for more information about the Developer toolbar

Managing Session State Values

When building interactive, data driven Web applications, the ability to access and manage session state values with ease is critical. In Oracle HTML DB, session state is automatically managed for every page and easily referenced in static HTML or logic controls such as processes or validations.

Topics in this section include:


See Also:

"Items" and "Referencing Item Values" for more information

Referencing Session State

Referencing the value of an item is one of the most common examples of referencing session state. In Oracle HTML DB, an item can be a field, a text area, a password, a select list, or check box. Table 6-2 describes the supported syntax for referencing item values.

Table 6-2 Syntax for Referencing Item Values

Type Syntax Description
SQL :MY_ITEM Standard bind variable syntax for items no longer than 30 characters. Use this syntax for references within a SQL query and within PL/SQL.
PL/SQL V('MY_ITEM') PL/SQL syntax referencing the item value using the V function.

See Also: "Oracle HTML DB APIs"

PL/SQL NV('MY_NUMERIC_ITEM') Standard PL/SQL syntax referencing the numeric item value using the NV function.

See Also: "Oracle HTML DB APIs"

Static Text (exact) &MY_ITEM. Static text. Exact Substitution.

Setting Session State

When a user submits a page in Oracle HTML DB, the HTML DB engine automatically stores values typed into fields (items) in session state. For example, suppose you have an application containing two pages. The first page of the application contains a form in which a user can enter a phone number. You have defined this form by creating an item named P2_PhoneNo. On the second page you want to display the information the user enters in the form.

When the page is submitted, Oracle HTML DB captures the value typed in the phone number field and stores the value for future use. The phone number typed by the user can then be retrieved from session state by referencing the item associated with the field on the page.

Clearing Session State

As you develop your applications, you may find it useful to clear the cached value for specific items, all items on a page, all pages in an application, or the current user session. Clearing a cached value resets the value to null. The topics that follow offer specific examples of clearing session state.

Clearing Cache by Item

Clearing cache for a single item resets the value of the item to null. For example, you might use this approach to make sure a specific item's value is null when a page is prepared for rendering.

The following example uses standard f?p syntax to clear the cache for an item. This example calls page 5 of application 100. Placing MY_ITEM in the ClearCache position of the f?p syntax resets the value of MY_ITEM to NULL.

f?p=100:5:&SESSION.::NO:MY_ITEM

The following example resets the value of the items THE_EMPNO and THE_DEPTNO.

f?p=100:5:&SESSION.::NO:THE_EMPNO,THE_DEPTNO

Clearing Cache by Page

Caching application items provides a very effective way to maintain session state. However, there are occasions when you may want to clear the cache for all items on a page. For example, suppose you needed to clear all fields on page when a user clicks a link the creates a new order. By clearing cache for an entire page you set the value of all items on the page to null.

Clearing Session Cache for Two Pages While Resetting Pagination

This example clears the session cache for two pages and resets pagination.

f?p=6000:6003:&SESSION.::NO:RP,6004,6014 

This example:

  • Runs page 6003 of application 6000 and uses the current session ID

  • Indicates to not show debug information (NO)

  • Clears all values maintained by the current session's cache for items of pages 6004 and 6014

  • Resets region pagination (RP) on page 6003 (the requested page)

Clearing Session Cache on a Page and Passing an Item Value

This example demonstrates a good way to implement an update form. It clears existing information and sets the item's value (typically a primary key).

f?p=6000:6003:&SESSION.::NO:6003:MY_ITEM:1234 

This example:

  • Runs page 6003 of application 6000 and use the current session ID

  • Indicates to not show debug information (NO)

  • Clears all values maintained by the current session's cache for items on page 6003

  • Sets the session state of an item called MY_ITEM to the value 1234

Clearing Session Cache on a Page and Passing Values to Multiple Items

This example is similar to the previous one except it passes values to multiple items.

f?p=6000:6004:&SESSION.::NO:6003:MY_ITEM1,MY_ITEM2,MY_ITEM3:1234,,5678 

This example:

  • Runs page 6004 of application 6000 and use the current session ID

  • Clears the current session's cache for items on page 6003

  • Indicates debug information should be hidden (NO)

  • Sets the value of MY_ITEM1 to 1234, sets the value of MY_ITEM2 to null (indicated by the comma used as placeholder), and sets the value of MY_ITEM3 to 5678

Clearing Cache for an Entire Application

You can also clear application cache by using f?p syntax by creating a REQUEST argument using the keyword APP using the following syntax:

f?p=App:Page:Session::NO:APP


Note:

Resetting the cache for an entire application does not actually restore the application to a completely reset state. For example, if an application includes on-new instance computations or on-new instance processes, the HTML DB engine runs these computations and processes when the application session is created. Then, it processes the clear cache request and displays the requested page.

The only way to reset the application completely without a session ID (if no cookie is used to track the session ID), is to request it using a URL without a session ID, or by calling HTMLDB_APPLICATION.CLEAR_APP_CACHE from another application. If the session ID is tracked using a cookie, you will need to logout in order to reset the state.


Clearing Cache for the Current User Session

You can also clear application cache by using f?p syntax. Create a REQUEST argument using the keyword SESSION. For example:

f?p=6000:6004:12507785108488427528::NO:SESSION

About Bind Variables

You can use bind variables within an application process or SQL query to reference session state of a specified item. For example:

SELECT * FROM emp WHERE name like '%' || :SEARCH_STRING || '%'

In this example, the search string is a page item. If the region type is defined as SQL Query, you can reference the value using standard SQL bind variable syntax. Using bind variables ensures that parsed representations of SQL queries are reused by the database, optimizing memory usage by the server.

When using bind variable syntax remember the following rules:

  • Bind variable names must correspond to an item name

  • Bind variable names are not case-sensitive

  • Bind variable names cannot be longer than 30 characters (that is, they must be a valid Oracle identifier)

    Although application items can be up to 255 characters, if you intend to use an application item within SQL using bind variable syntax, the item name must be 30 characters or less.

Using Bind Variables in Regions Based on a SQL Query or LOV

If your region type is defined as a SQL Query, SQL Query (plsql function body returning SQL query), or list of values (LOV) you can reference session state using the syntax:

:MY_ITEM

One common way to do this is to incorporate a session state variable in a WHERE clause. The following example demonstrates how to bind the value of the item THE_DEPTNO into a region defined from a SQL Query.

SELECT ename, job, sal
FROM emp
WHERE deptno = :THE_DEPTNO


See Also:

"Customizing Regions" for more information on creating different types of regions

Using Bind Variables in PL/SQL Procedures

For region types defined as a PL/SQL Procedure, regions are constructed using PL/SQL anonymous block syntax. In other words, the beginning and ending are added automatically around the PL/SQL. For example:

INSERT INTO emp (empno, ename, job) 
VALUES (:P1_empno, :P1_name, :P1_job);

In this example, the values of the empno, ename, and job are populated by the values of P1_empno, P1_name, and P1_job.

Understanding URL Syntax

Each application has a number (called an application ID) or alphanumeric alias which uniquely identifies it. Similarly, each page also has a unique number (called a page number) or an alphanumeric alias. When you run an application, the HTML DB engine generates a session number that serves as a key to the user's session state.

The URL that displays for each page indicates the location of Oracle HTML DB and identifies the application ID, page number, and session ID. For example:

http://htmldb.oracle.com/pls/otn/f?p=4350:1:220883407765693447

This example indicates that:

Using f?p Syntax to Link Pages

You can create links between pages in your application using the following syntax:

f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly

Table 6-3 describes the possible arguments you can pass when using f?p syntax.

Table 6-3 f?p Syntax Arguments

Syntax Description
App Indicates an application ID or alphanumeric alias.
Page Indicates a page number or alphanumeric alias.
Session Identifies a session ID. You can reference a session ID to create hypertext links to other pages that maintain the same session state by passing the session number. You can reference the session ID using the syntax:
  • Short substitution string: &SESSION.

  • PL/SQL: V('SESSION')

  • Bind variable: :APP_SESSION

Request Sets the value of REQUEST. Each application button sets the value of REQUEST to the name of the button. This enables accept processing to reference the name of the button when a user clicks it. You can reference REQUEST using the syntax:
  • Substitution string: &REQUEST.

  • PL/SQL: V('REQUEST')

  • Bind variable: :REQUEST

Debug Displays application processing details. Valid values for the DEBUG flag are YES or NO. Setting this flag to YES displays details about application processing. You can reference the Debug flag using the following syntax:
  • Short substitution string: &DEBUG.

  • PL/SQL: V('DEBUG')

  • Bind variable: :DEBUG

ClearCache Clears cache. Clearing cache for a single item simply sets the value of the list of names to null. To clear cached items, use a comma delimited list of page numbers. Comma delimited lists can also contain collections to be reset or the keyword RP, which resets region pagination on the requested page.
itemNames Comma delimited list of item names used to set session state with a URL.
itemValues List of item values used to set session state within a URL. Item values may not include colons, but may contain commas if enclosed with baskslashes. To pass a comma in an item value, enclose the characters with backslashes. For example:
\123,45\

PrinterFriendly Determines whether the page is being rendered in printer friendly mode. If PrinterFriendly is set to Yes, then the page is rendered in printer friendly mode. The value of PrinterFriendly can be used in rendering conditions to remove elements such as regions from the page to optimize printed output.You can reference the printer friendly preference by using the syntax:
V('PRINTER_FRIENDLY')

When referenced, the HTML DB engine will not display tabs or navigation bars and all items will be displayed as text and not as form elements.


Although it is important to understand how f?p syntax works, you rarely have to construct this syntax yourself. Oracle HTML DB includes many wizards that automatically create these references for you. The sections that follow describe a number of specific instances that utilize f?p syntax to link pages.

Calling a Page Using an Application and Page Alias

Application and page aliases must consist of valid Oracle identifiers, cannot contain any whitespace, and are not case-sensitive. The following example calls a page using an application and a page alias from within an Oracle HTML DB application. It runs the page home of the application myapp and uses the current session ID.

f?p=myapp:home:&SESSION.

Application aliases must be unique within a workspace. If applications in different workspaces within the same Oracle HTML DB instance have the same application alias, use the &c argument to specify the workspace name. For example:

f?p=common_alias:home:&session.&c=WORKSPACE_A

Calling a Page from a Button URL

When you create a button, you can specify a URL to redirect to when the user clicks the button. This example runs page 6001 of application 6000 and uses the current session ID.

f?p=6000:6001:&SESSION.

Note that this is only one approach to using a button in Oracle HTML DB. This method bypasses page submission and acts as a hyperlink on the page. Another method is to submit the page first. In that approach, clicking the button submits the page for processing, allowing forms to be submitted and session state to be saved.


See Also:

"Creating Buttons"

Using Substitution Strings

You can use substitution strings within a page template or region source to replace a character string with another value. As you design your application and enable users to edit items, you will need to use substitution strings in order to pass information.

You can use substitution strings in Oracle HTML DB in the following ways.

Substitution strings used within a template contain the pound symbol (#). For example:

#ABC#

Substitution strings created at the application level do not display, but are used as variables to maintain session state. You can define page items as an attribute of a page. You can use this type of session state substitution at the application or page level. For example:

&MY_ITEM.

Built-in Substitution Strings

Application Builder supports a number of built-in substitution strings. You may need to reference these values in order to achieve specific types of functionality.

The sections that follow describe these substitution strings, when to use them, and what supported syntax is currently available. Note that no short bind variable exists for SESSION or USER since both are Oracle reserved words.

Topics in this section include:


See Also:


APP_ALIAS

APP_ALIAS is alphanumeric name for the current application. APP_ALIAS is different from the APP_ID in that the APP_ID must be unique over all companies and all applications hosted in one database. In contrast, APP_ALIAS must be unique within a workspace. Using the same APP_ALIAS you can create an application called ABC in two workspaces. You can use APP_ALIAS almost anywhere a APP_ID can be used. For example, f?p Syntax can use an APP_ALIAS or an application ID as demonstrated in this example:

f?p=ABC:1:&SESSION.

This example runs application ABC, page 1 using the current session.

Table 6-4 describes the supported syntax for referencing APP_ALIAS.

Table 6-4 APP_ALIAS Syntax

Reference Type Syntax
Bind variable :APP_ALIAS
PL/SQL V('APP_ALIAS')
Substitution string &APP_ALIAS.

The following is an HTML example:

Click me to go to page 1 <a href="f?p=&APP_ALIAS.:1:&SESSION."> of the current application</a>

APP_ID

APP_ID identifies the application ID of the currently executing application. Table 6-5 describes the supported syntax for referencing APP_ID.

Table 6-5 APP_ID Syntax

Reference Type Syntax
Bind variable :APP_ID
Direct PL/SQL HTMLDB_APPLICATION.G_FLOW_ID (A NUMBER)
PL/SQL NV('APP_ID')
Substitution string &APP_ID.

The following is an example of a substitution string reference:

f?p=&APP_ID.:40:&SESSION.

APP_IMAGES

Use this substitution string to reference uploaded images, JavaScript, and cascading style sheets that are specific to a given application and are not shared over many applications. If you upload a file and make it specific to an application, then you must use this substitution string, or bind variable. Table 6-6 describes the supported syntax for referencing APP_IMAGES.

Table 6-6 APP_IMAGES Syntax

Reference Type Syntax
Bind variable :APP_IMAGES
Direct PL/SQL Not available.
PL/SQL V('APP_IMAGES')
Substitution string &APP_IMAGES.
Template Substitution #APP_IMAGES#

APP_PAGE_ID

APP_PAGE_ID is the current application page number. For example, if your application was on page 3 then the result would be 3. Using this syntax is useful when writing application components that need to work generically in multiple applications. Table 6-7 describes the supported syntax for referencing APP_PAGE_ID.

Table 6-7 APP_PAGE_ID Syntax

Reference Type Syntax
Bind variable :APP_PAGE_ID
Direct PL/SQL HTMLDB_APPLICATION.G_FLOW_STEP_ID (A NUMBER)
Direct PL/SQL :APP_PAGE_ID
PL/SQL NV('APP_PAGE_ID')
Substitution string &APP_PAGE_ID.

The following is an example of a substitution string reference:

f?p=&APP_ID.:&APP_PAGE_ID.:&SESSION.

APP_SESSION

APP_SESSION is one of the most commonly used built-in substitution strings. You can use this substitution string to create hypertext links between application pages that maintain a session state by passing the session number. Table 6-8 describes the supported syntax for referencing APP_SESSION.

Table 6-8 APP_SESSION Syntax

Reference Type Syntax
Bind variable :APP_SESSION
PL/SQL V('APP_SESSION')
Short PL/SQL V('SESSION')
Short substitution string &SESSION.
Substitution string &APP_SESSION.

Consider the following examples:

  • From within an HTML Region:

    <a href="f?p=100:5:&SESSION.">click me</a> 
    
    
  • Using PL/SQL:

    htf.anchor('f?p=100:5:'||V('SESSION'),'click me');
    
    
  • Using a SQL query:

    SELECT htf.anchor('f?p=100:5:'||:app_session,'clickme') FROM DUAL;
    
    

APP_UNIQUE_PAGE_ID

APP_UNIQUE_PAGE_ID is an integer generated from an Oracle sequence which is unique for each page view. This number is used by applications to prevent duplicate page submissions and can be used for other purposes. For example, if you wish to make a unique URL to avoid browser caching issues, you can embed this number in the request or debug column in calls to the f procedure. Table 6-9 describes the supported syntax for referencing APP_UNIQUE_PAGE_ID.

Table 6-9 APP_UNIQUE_PAGE_ID Syntax

Reference Type Syntax
Bind variable :APP_UNIQUE_PAGE_ID
PL/SQL V('APP_UNIQUE_PAGE_ID')
Substitution string &APP_UNIQUE_PAGE_ID.

The following is an HTML example:

SELECT 'f?p=100:1:'||:APP_SESSION||':'||:APP_UNIQUE_PAGE_ID||
    ':::P1_EMPNO:'||empno,
   ename,
    job
FROM emp

Note the use of the APP_UNIQUE_PAGE_ID in the request column. This makes this URL unique and may avoid excessive browser caching problems.

APP_USER

APP_USER is the current user running the application. Depending upon your authentication model, the value of the user is set differently. If the application is running using database authentication, then the value of the user is the same as the database pseudo column USER. If the application uses an authentication scheme that requires the user to authenticate, the value of APP_USER is set by the authentication scheme, usually to the user name used during authentication. Table 6-10 describes the supported syntax for referencing APP_USER.

Table 6-10 APP_USER Syntax

Reference Type Syntax
Bind variable :APP_USER
PL/SQL V('APP_USER')
Short PL/SQL V('USER')
Substitution string &USER.

Consider the following examples:

  • From within an HTML Region:

    Hello you are logged in as &USER.
    
    
  • Using PL/SQL:

    htp.p('Hello you are logged in as'||V('USER')); 
    
    
  • As a bind variable:

    SELECT * FROM some_table WHERE user_id = :app_user
    
    

AUTHENTICATED_URL_PREFIX

This application level attribute identifies a valid authenticated prefix (that is, a logged in URL prefix). You can use a relative path or a full path beginning with http. This item is useful if your application can be run in both authenticated (logged in) and public (not logged in) modes. You can use AUTHENTICATED_URL_PREFIX to construct a link to an authenticated page. This item is most useful when using basic database authentication since changes to the URL can require authentication. Table 6-11 describes the supported syntax for referencing AUTHENTICATED_URL_PREFIX.

Table 6-11 AUTHENTICATED_URL_PREFIX Syntax

Reference Type Syntax
Bind variable :AUTHENTICATED_URL_PREFIX
PL/SQL V('AUTHENTICATED_URL_PREFIX')
Substitution string &AUTHENTICATED_URL_PREFIX.

BROWSER_LANGUAGE

BROWSER_LANGUAGE refers to the Web browser's current language preference. Table 6-12 describes the supported syntax for referencing BROWSER_LANGUAGE.

Table 6-12 BROWSER_LANGUAGE Syntax

Reference Type Syntax
Bind variable :BROWSER_LANGUAGE
Direct PL/SQL HTMLDB_APPLICATION.G_BROWSER_LANGUAGE
PL/SQL V('BROWSER_LANGUAGE')
Substitution string :BROWSER_LANGUAGE.
Substitution string &BROWSER_LANGUAGE.

CURRENT_PARENT_TAB_TEXT

CURRENT_PARENT_TAB_TEXT is most useful in page templates, but is only relevant for applications that use two level tabs (that is, parent and standard tabs). Use this string to reference the parent tab label. This substitution string enables you to repeat the currently selected parent tab within the page template. Table 6-13 describes the supported syntax for referencing CURRENT_PARENT_TAB_TEXT.

Table 6-13 CURRENT_PARENT_TAB_TEXT Syntax

Reference Type Syntax
Bind variable Not Available.
Substitution string &CURRENT_PARENT_TAB_TEXT.

DEBUG

Valid values for the DEBUG flag are YES or NO. Turning debug on shows details about application processing. If you write your own custom code, you may wish to generate debug information only if the debug mode is set to YES. Table 6-14 describes the supported syntax for referencing DEBUG.

Table 6-14 DEBUG Syntax

Reference Type Syntax
Bind variable :DEBUG
Direct PL/SQL HTMLDB_APPLICATION.G_DEBUG
PL/SQL V('DEBUG')
Substitution string &DEBUG.

The following is an example of a substitution string reference that preserves the current value of DEBUG:

f?p=100:1:&SESSION.::&DEBUG

HOME_LINK

HOME_LINK is the home page of an application. The HTML DB engine will redirect to this location if no page is given and if no alternative page is dictated by the authentication scheme's logic. You define the Home Link on Application Attributes page.

Table 6–11 describes the supported syntax for referencing HOME_LINK.

Table 6-15 HOME_LINK Syntax

Reference Type Syntax
Direct PL/SQL HTMLDB_APPLICATION.G_HOME_LINK
PL/SQL V('HOME_LINK')
Template Reference #HOME_LINK#
Substitution String &HOME_LINK.


See Also:

"Session Management" for more information on the Home Link attribute

IMAGE_PREFIX

The value of IMAGE_PREFIX determines the virtual path the Web server uses to point to the images directory distributed with Oracle HTML DB. If you wish to reference uploaded images, use WORKSPACE_IMAGES and APP_IMAGES. Table 6-16 describes the supported syntax for referencing IMAGE_PREFIX.

Table 6-16 IMAGE_PREFIX Syntax

Reference Type Syntax
Bind variable :IMAGE_PREFIX
Direct PL/SQL HTMLDB_APPLICATION.G_IMAGE_PREFIX
PL/SQL V('IMAGE_PREFIX')
Substitution string &IMAGE_PREFIX.
Template Substitution #IMAGE_PREFIX#

HTML DB SCHEMA OWNER

If you are generating calls to applications from within your PL/SQL code, you may need to reference the owner of the Oracle HTML DB schema. The following describes the correct syntax for a direct PL/SQL reference:

HTMLDB_APPLICATION.G_FLOW_SCHEMA_OWNER

You may also use #FLOW_OWNER# to reference this value in SQL queries and PL/SQL (for example, in a region or a process).

PRINTER_FRIENDLY

The value of PRINTER_FRIENDLY determines whether the HTML DB engine is running in print view mode. This setting can be referenced in conditions to eliminate elements not desired in a printed document from a page. Table 6-17 describes the supported syntax for referencing PRINTER_FRIENDLY.

Table 6-17 PRINTER_FRIENDLY Syntax

Reference Type Syntax
Direct PL/SQL HTMLDB_APPLICATION.G_PRINTER_FRIENDLY (VARCHAR2 DATATYPE)
PL/SQL V('PRINTER_FRIENDLY')
Substitution string &PRINTER_FRIENDLY.

LOGOUT_URL

LOGOUT_URL is application level attribute used to identify the logout URL. This is a URL that navigates the user to a logout page or optionally directly logs a user out. To create a logout navigation bar icon, use &LOGOUT_URL for the navigation bar link. If you are coding a page template use #LOGOUT_URL#. Table 6-18 describes the supported syntax for referencing LOGOUT_URL.

Table 6-18 LOGOUT_URL Syntax

Reference Type Syntax
Bind variable :LOGOUT_URL
PL/SQL V('LOGOUT_URL')
Substitution string &LOGOUT_URL.
Template Substitution #LOGOUT_URL#

PROXY SERVER

PROXY SERVER is an application attribute. The attribute may be used by regions whose source comes from a URL. The following is the correct syntax for a direct PL/SQL reference used when you are writing PL/SQL to access remote Web servers from within the database (for example, when using the utl_http package shipped with the database).

HTMLDB_APPLICATION.G_PROXY_SERVER

PUBLIC_URL_PREFIX

PUBLIC_URL_PREFIX is an application level attribute that identifies a URL to toggle out of a logged in mode to a public view. Table 6-19 describes the supported syntax for referencing PUBLIC_URL_PREFIX.

Table 6-19 PUBLIC_URL_PREFIX Syntax

Reference Type Syntax
Bind variable :PUBLIC_URL_PREFIX
PL/SQL V('PUBLIC_URL_PREFIX')
Substitution string &PUBLIC_URL_PREFIX.
Template Substitution #PUBLIC_URL_PREFIX#

REQUEST

Each application button sets the value of REQUEST to the name of the button. This enables accept processing to reference the name of the button when a user clicks it. In the f?p syntax, REQUEST may be set using the fourth argument.

Referencing the Value of REQUEST

REQUEST is typically referenced during Accept processing (that is, the processing that occurs when you post a page). Table 6-20 describes the supported syntax for referencing REQUEST.

Table 6-20 REQUEST Syntax

Reference Type Syntax
Bind variable :REQUEST
Direct PL/SQL HTMLDB_APPLICATION.G_REQUEST
PL/SQL V('REQUEST')
Substitution string &REQUEST

&REQUEST. (exact syntax match)


Scope and Value of REQUEST for Posted Pages

When you post a page, you initiate Accept processing. Accept processing consists of computations, validations, processes, and branches. The value of request is available during each phase of the Accept processing. Once Oracle HTML DB branches to a different page then REQUEST is set to NULL.

The value of REQUEST is the name of the button the user clicks, or the name of the tab the user selects. For example, suppose you have a button with a name of "CHANGE", and a label of "Apply Change." When a user clicks the button the value of REQUEST will be CHANGE.

Referencing REQUEST Using Declarative Conditions

It is common to reference REQUEST using conditions. For example, you may wish to reset pagination when a user clicks Go on a report page. You can reset pagination by creating a on-submit page process. The page process can be made conditional using the condition Request = Expression 1.

To create an on-submit page process:

  1. Under Conditional Display, select the condition type Request = Expression 1.

  2. In Expression 1, enter GO.

Using REQUEST for Show Processing

You can also use REQUEST for Show processing when navigating to a page using f?p syntax. For example:

f?p=100:1:&SESSION.:GO

Remember that the fourth argument is in the f?p syntax is REQUEST. This example goes to application 100, page 1 for the current session and sets the value of REQUEST to GO. Any process or region can reference the value of REQUEST using Show processing.

The following is a similar example using PL/SQL:

IF V ('REQUEST') = 'GO' THEN
   htp.p('hello');
END IF;

Note that htp.p('hello') is a call to a PL/SQL Web Toolkit package in order to print out the specified text string.


See Also:


SQLERRM

SQLERRM is template substitution only available in the Applications Region Error Message. The following describes the correct syntax for a region template substitution reference:

#SQLERRM#

SYSDATE_YYYYMMDD

SYSDATE_YYYYMMDD represents the current date on the database server, with the YYYYMMDD format mask applied. You may use this value instead of repeated calls to the SYSDATE() function. The following list describes the supported syntax for referencing SYSDATE_YYYYMMDD.

  • Bind variable:

    :SYSDATE_YYYYMMDD
    
    
  • PL/SQL:

    V('SYSDATE_YYYYMMDD')
    
    
  • Direct PL/SQL:

    HTMLDB_APPLICATION.G_SYSDATE (DATE DATATYPE)
    
    

Table 6-21 SYSDATE_YYYYMMDD Syntax

Reference Type Syntax
Bind variable :SYSDATE_YYYYMMDD
Direct PL/SQL HTMLDB_APPLICATION.G_SYSDATE (DATE DATATYPE)
PL/SQL V('SYSDATE_YYYYMMDD')

WORKSPACE_IMAGES

Use this substitution string to reference uploaded images, JavaScript, and cascading style sheets that are shared over many applications within a workspace. Table 6-22 describes the supported syntax for referencing WORKSPACE_IMAGES.

Table 6-22 WORKSPACE_IMAGES Syntax

Reference Type Syntax
Bind variable :WORKSPACE_IMAGES
Direct PL/SQL Not available.
PL/SQL V('WORKSPACE_IMAGES')
Substitution string &WORKSPACE_IMAGES.
Template Substitution #WORKSPACE_IMAGES#