Skip to topic | Skip to bottom
Home
You are here: TWiki > Apex Web > PitfallsCategory r7 - 17 Jul 2006 - 12:19 - ColinSheppard


Start of topic | Skip to actions

Pitfalls

Here are some pitfalls to look out for!

Reconsider Relying on the Built-in Authorization Scheme MUST_NOT_BE_PUBLIC_USER

A problem exists with the value of APP_USER being used for an unauthenticated session versus what the MUST_NOT_BE_PUBLIC_USER authorization scheme expects.

I have had the problem of wanting to change the public (unauthenticated) user of 'nobody' to guest, as peformed by the On Demand Application Process below:

IF v('APP_USER') = 'nobody' 
THEN
HTMLDB_CUSTOM_AUTH.SET_USER(
  p_user => 'Guest');
END IF;

This in turn was run on the pages I wanted, like the Logon Page of my Apex application.

I was encountering a problem where by after changing the user name, all my previously hidden tabs that were made hidden by the MUST_NOT_BE_PUBLIC_USER authorization scheme, were suddenly visible. It was recommend not using that authenticaiton scheme for the tabs, using one that you create instead that checks if :APP_USER = 'nobody' (or whatever the user name is).

Source: http://forums.oracle.com/forums/thread.jspa?messageID=623367&#623367

Author: ColinSheppard - 17 Jul 2006

Page after Logon has a Different, Incorrect Start

If you have a logon technique that goes to different webpages depending on who the user it, it might be that when you logon on again, it might go to the incorrect page. For example, all on the same browser window:

User A should go and does go to page 6000. User A then does logout.

User B should go to page 7000, but much of the details (like region) are those of page 6000.

This is due to the Application Item FSP_AFTER_LOGIN_URL maintaining 'memory' of its past logon actvity. The solution is to do this in the pre-authentication process of the authentication scheme:

   :FSP_AFTER_LOGIN_URL := null;

This erases any deep link that might have been "remembered". The arguments to the login process will then be used to determine the after-login page.

Source: http://forums.oracle.com/forums/thread.jspa?messageID=1279875&#1279875

The item FSP_AFTER_LOGIN_URL is maintained internally to remember the page the user attempted to visit before they were shown the login page. You should rarely have to worry about its state or set it yourself.

Source: http://forums.oracle.com/forums/message.jspa?messageID=648306#648306

Author: ColinSheppard

Using Two Schemas

If Schema (aside from the main schema) does not show during a HTML DB Wizard activity, its because you may need to grant select privilege on the objects to the other schema(s) for the wizards to be able to see them when using the Builder in the grantee's schema.

Source: http://forums.oracle.com/forums/thread.jspa?threadID=348681

Author: ColinSheppard

Tree Disappearing or Vanishing

If a Tree Item's tree vanishes or disappears its probably because of:

  • The need to move that hidden item to a region that displays above where the tree region displays so the tree can reference the root node item's value.

Source: http://forums.oracle.com/forums/thread.jspa?messageID=661485

Author: ColinSheppard

Remove that ';' at the end of a string for SQL in a PL/SQL Procedure

When typing SQL statement that will be storated as a string in a procedure/function, make sure the ';' does not exist at the end of thestring!

For example:

l_sql := 'select id, name, address from employee;'

should really be:

l_sql := 'select id, name, address from employee'

Author: ColinSheppard

Image Constantly Refreshing

In its usual state, when changing pages in HTML DB you may find that the image is constantly redrawing itself.

You can prevent this by ensuring that the download function associated with the image contains this:

htp.p('Expires: ' || TO_CHAR(SYSDATE + 1/24, 'Day, DD Month, YYYY HH24:MI:SS'));

The full image download/display function is:

 PROCEDURE  "DOWNLOAD_MY_FILE" (p_file IN NUMBER) AS
  v_mime VARCHAR2(48);
  v_length NUMBER;
  v_file_name VARCHAR2(2000);
  Lob_loc BLOB;
 BEGIN
  SELECT MIME_TYPE, BLOB_CONTENT, FILE_NAME_BROWSED, DBMS_LOB.GETLENGTH(BLOB_CONTENT)
  INTO v_mime, lob_loc, v_file_name, v_length
  FROM BG_CONTENT_BINARY_FILE
  WHERE BLOB_FILE_ID = p_file;
  --
  -- set up HTTP header
  --
  -- use an NVL around the mime type and
  -- if it is a null set it to application/octect
  -- application/octect may launch a download window from windows
  owa_util.mime_header( NVL(v_mime,'application/octet'), FALSE );
  -- set the size so the browser knows how much to download
  htp.p('Content-length: ' || v_length);
  htp.p('Expires: ' || TO_CHAR(SYSDATE + 1/24, 'Day, DD Month, YYYY HH24:MI:SS'));
  -- the filename will be used by the browser if the users does a save as
  htp.p('Content-Disposition: attachment; filename="'||SUBSTR(v_file_name,INSTR(v_file_name,'/')+1)|| '"');
  -- close the headers
  owa_util.http_header_close;
  -- download the BLOB
  wpg_docload.download_file( Lob_loc );
 END Download_My_File;

PS: Don't forget to grant access to this procedure!

GRANT EXECUTE ON download_my_file TO PUBLIC 
/

Author: ColinSheppard

Nested Forms

HTML DB opens and closes a form on every page. The location of the HTML DB generated <form...> and </form> tags is determined by the #FORM_OPEN# and #FORM_CLOSE# tags in the page template. Adding your own form tags between these tags will INSTANTLY BREAK YOUR APPLICATION. A common symptom of this that the tool works fine, running one page of your application works fine, but you get a 404 when you do anything that would post a page in your application.

Author: TylerMuth

Tabs Second Level

Sometimes the Second Level of tabs may not appear in the application when creating them manually. To ensure that they display, you need to edit:

Page Definition > Edit Attributes > Display Attributes > Standard Template Set

Example

Source: http://forums.oracle.com/forums/thread.jspa?messageID=1161684&#1161684

You can check also what might be not properly assigned by looking at the Tab Utilization Table's "Page References" column:

Home > Application Builder > Application nnn > Shared Components > Tabs > Tab Utilization

It should become obvious that what had been created was not assigned.

I also noted a interesting step-by-step description on how to create tabs in this forum posting:

Source: http://forums.oracle.com/forums/thread.jspa?messageID=1074758&#1074758

I noticed this advice as well in regards to making 2 level tabs that the things you need to get straight are:

  1. Your parent tabs and sub tabs are all created and connected to each other correctly.
  2. Your tabs all have at least one unique page assigned to each tab.
  3. Your pages are all set to use the default page template - unless you don't want to for specific pages for some reason.
  4. Your default page template is changed to a 2 level tab page for the theme you're using.

Source: http://forums.oracle.com/forums/message.jspa?messageID=1115985#1115985

Author: ColinSheppard - 09 Jan 2006

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r7 < r6 < r5 < r4 < r3 | More topic actions
This site is powered by the TWiki collaboration platformCopyright © 1999-2010 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback