19 APEX_PAGE

The APEX_PAGE package is the public API for handling pages.

Global Constants

The following constants are used by this package.

c_ui_type_desktop        constant varchar2(10) := 'DESKTOP';
c_ui_type_jqm_smartphone constant varchar2(15) := 'JQM_SMARTPHONE';

IS_DESKTOP_UI Function

This function returns TRUE if the current page has been designed for desktop browsers.

Syntax

FUNCTION IS_DESKTOP_UI 
RETURN BOOLEAN;

IS_JQM_SMARTPHONE_UI Function

This function returns TRUE if the current page has been designed for smartphone devices using jQuery Mobile.

Syntax

FUNCTION IS_JQM_SMARTPHONE_UI
RETURN BOOLEAN;

IS_JQM_TABLET_UI Function

This function returns TRUE if the current page has been designed for tablet devices using jQuery Mobile.

Syntax

FUNCTION IS_JQM_TABLET_UI
RETURN BOOLEAN;

GET_UI_TYPE Function

This function returns the user interface (UI) type for which the current page has been designed.

Syntax

FUNCTION GET_UI_TYPE 
RETURN VARCHAR2;

IS_READ_ONLY Function

This function returns TRUE if the current page is rendered read-only and FALSE if it is not.

Syntax

FUNCTION IS_READ_ONLY
RETURN BOOLEAN;

GET_PAGE_MODE Function

This function returns the page mode for the current page.

Syntax

FUNCTION GET_PAGE_MODE (
    p_application_id        IN NUMBER,
    p_page_id 
    RETURN VARCHAR2;

Parameters

Table 19-1 GET_PAGE_MODE Parameters

Parameter Description

p_application_id

ID of the application. Defaults to the current application.

p_page_id

ID of the page. Defaults to the current page.


PURGE_CACHE Procedure

This procedure purges the cache of the specified application, page, and region for the specified user. If the user is not specified, the procedure purges all cached versions of the page.

Syntax

PROCEDURE PURGE_CACHE (
    p_application_id       IN NUMBER DEFAULT wwv_flow.g_flow_id,
    p_page_id              IN NUMBER DEFAULT wwv_flow.g_flow_step_id,
    p_user_name            IN VARCHAR2 DEFAULT NULL,
    p_current_session_only IN BOOLEAN  DEFAULT FALSE );

Parameters

Table 19-2 PURGE_CACHE Parameters

Parameter Description

p_application_id

ID of the application. Defaults to the current application.

p_page_id

ID of the page.Defaults to the current page. If you pass NULL, Oracle Application Express purges the cache on all pages of the application.

p_user_name

Specify a user name if you only want to purge entries that were saved for the given user.

p_current_session_only

Specify TRUE if you only want to purge entries that where saved for the current session. Defaults to FALSE.


Example

This example purges session specific cache on the current page.

BEGIN
     APEX_PAGE.PURGE_CACHE (
         p_current_session_only => true );
END;

GET_URL Function

This function returns an Oracle Application Express f?p= URL. It is sometimes clearer to read a function call than a concatenated URL. See the example below for a comparison.

Syntax

FUNCTION GET_URL (
    p_application        IN VARCHAR2 DEFAULT NULL,
    p_page               IN VARCHAR2 DEFAULT NULL,
    p_session            IN NUMBER   DEFAULT WWV_FLOW.G_INSTANCE,
    p_request            IN VARCHAR2 DEFAULT NULL,
    p_debug              IN VARCHAR2 DEFAULT NULL,
    p_clear_cache        IN VARCHAR2 DEFAULT NULL,
    p_items              IN VARCHAR2 DEFAULT NULL,
    p_values             IN VARCHAR2 DEFAULT NULL,
    p_printer_friendly   IN VARCHAR2 DEFAULT NULL,
    p_trace              IN VARCHAR2 DEFAULT NULL )
    RETURN VARCHAR2;

Parameters

Table 19-3 GET_URL Parameters

Parameter Description

p_application

The application ID or alias. Defaults to the current application.

p_page

Page ID or alias. Defaults to the current page.

p_session

Session ID. Defaults to the current session ID.

p_request

URL request parameter.

p_debug

URL debug parameter. Defaults to the current debug mode.

p_clear_cache

URL clear cache parameter.

p_items

Comma-delimited list of item names to set session state.

p_values

Comma-delimited list of item values to set session state.

p_printer_friendly

URL printer friendly parameter. Defaults to the current request's printer friendly mode.

p_trace

SQL trace parameter.


Example

This query uses APEX_PAGE.GET_URL and its alternative APEX_UTIL.PREPARE_URL to produce two identical URLs.

SELECT APEX_PAGE.GET_URL (
            p_page   => 1,
            p_items  => 'P1_X,P1_Y',
            p_values => 'somevalue,othervalue' ) f_url_1,
         APEX_UTIL.PREPARE_URL('f?p=&APP_ID.:1:&APP_SESSION.::::P1_X,P1_Y:somevalue,othervalue')
     FROM DUAL