Java, JEE, Application Express, GWT, Oracle, Linux, Web Development
Thursday, July 12, 2007
Friday, July 06, 2007
Clear Page Cache When Using Tabs & Sub-tabs
Update - 14th Nov 2007 : I have posted a cleaner solution to this at http://kristianjones.blogspot.com/2007/11/clear-page-cache-when-using-tabs-sub.html Most pages you create in Apex have a number of modes that govern when processes, items and regions are displayed, executed or evaluated. Typically this involves setting a hidden page item and testing your condition against that item in the “Conditional Display” pane within the developer mode. When developing applications with tabs (and sub tabs) you’ll discover that you cant process the request value for your tab as Apex manages the branch conditions for you. An example scenario may be where you want to clear the page cache only on new requests. One method to get round the problem is to create a hidden item on page 0 and called “P0_PAGE_NEW” Navigate to Applications -> Shared Components -> Application Processes and hit “create” in the application builder. Create a process which runs “On Submit: After Page Submission – Before Computations and Validations”. In Process Source Type the followingIF (:REQUEST = 'T_YOUR_TAB_NAME’) THEN :P0_PAGE_NEW := 'Y'; END IF;Now you can create a “On Load – Before Header” session state page process to clear the session that is conditional on :P0_PAGE_NEW being set to ‘Y’. Once you’ve cleared the page cache, just set :P0_PAGE_NEW to ‘N’ in a “On Load – Before Header” pl/sql page process which runs unconditionally with the following source:
begin :P0_PAGE_NEW := 'N'; end ;The cache should now be cleared with every new page visit. Now imagine, you have one or more tabs which point to the same page. Ideally you would like to have each tab a cause a different action or set of items to be displayed (hypothetically). To do this you can just add to the application process you have created but instead you would set you page mode type item on the page. From there it is a simple matter of conditioning your processes, items and regions to executed or be displayed against that page mode item
Labels:
Application Express,
Oracle,
PL/SQL
Subscribe to:
Posts (Atom)