Home > Application Builder Concepts > Managing Session State Values > Clearing Session State
Previous |
Next |
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.
Topics:
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:&APP_SESSION.::NO:MY_ITEM
The following example resets the value of the items THE_EMPNO
and THE_DEPTNO
.
f?p=100:5:&APP_SESSION.::NO:THE_EMPNO,THE_DEPTNO
Caching application items provides an 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 a page when a user clicks a link that creates a new order. By clearing the cache for an entire page, you set the value of all items on the page to null.
This example clears the session cache for two pages and resets pagination.
f?p=6000:6003:&APP_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)
This example shows how to implement an update form. It clears existing information and sets the item's value (typically a primary key).
f?p=6000:6003:&APP_SESSION.::NO:6003:MY_ITEM:1234
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 on page 6003
Sets the session state of an item called MY_ITEM
to the value 1234
This example is similar to the previous example, except it passes values to multiple items.
f?p=6000:6004:&APP_SESSION.::NO:6003:MY_ITEM1,MY_ITEM2,MY_ITEM3:1234,,5678
This example:
Runs page 6004 of application 6000 and uses 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
You can clear an application's cache by using f?p
syntax and creating a Clear Cache
argument using the keyword APP. For example:
f?p=App:Page:Session::NO:APP
Note: Resetting the cache for an entire application does not restore the application to a completely reset state. For example, if an application includes on-new instance computations or on-new instance processes, the Application Express engine runs these computations and processes when the application session is created. Then, it processes the clear cache request and displays the requested page.To reset an application completely without a session ID (if no cookie is used to track the session ID), you must request it using a URL without a session ID, or by calling |