How To Display Iconic Images Using Forms

How to display images/icons on the buttons

Steps are

  1. Example 1: Using a jar file
    =====================1] Gather all the icon files in a directory.
    For this copy all the icons files (gif or jpg) to a folder e.g c:\icons or /tmp/icons folder

    2] Create the jar including the icons.
    Change directory to the target icons folder:
    cd c:\icons or cd /tmp/icons

    To jar the icon files issue:

    jar -cvf icons.jar *

    3] Place the jar in <oracle_home>\forms\java

    4] Edit the <oracle_home>\forms\server\formsweb.cfg (*)

    4a) Tell the applet to load the jar:

              archive=frmall.jar,icons.jar  (Sun JRE)

              archive_jini=xxall_jinit.jar,icons.jar (JInitiator)

4b) Indicate the images are relative to forms/java virtual directory:

              imageBase can be set to documentBase or codeBase, for example:

imageBase=codeBase

To indicate that the images are now in a directory under imageBase this can be done either in the “Icon Filename” property of each forms item or rather for all images by changing the default iconpath in the file Registry.dat. For example the following line :

default.icons.iconpath=icons

will tell the Forms Runtime to fetch the icons from:
<imageBase>/icons
As in our example imageBase has been set to codeBase in step 4 this means: http://host:port/forms/java/icons which corresponds to the directory structure icons/* inside the jar placed at http://host:port/forms/java .

  1. Example 2: Using individual image files
    ===============================

    1. Determine the physical location of the icons on your server.
    For this example, assume that the icons are stored in D:\Myfiles\icons.

    2. Determine a virtual directory name under /forms then map it to this physical location.
    For this example assume the virtual directory is named /forms/myicons. The mapping is done differently whether using the Developer Suite or the Application server:

    2a. If using the Developer Suite:
    The virtual directory under /forms is set with a line in the file
    <DevSuite_home>\j2ee\DevSuite\application-deployments\forms\formsweb\orion-web.xml
    that contains various lines already, like this one for /jinitiator:

    <virtual-directory virtual-path=”/jinitiator” real-path=”(your_DS_home)/jinit” />

    Add your new line under it, such as:

    <virtual-directory virtual-path="/jinitiator" real-path="(your_DS_home)/jinit" /> 
    <virtual-directory virtual-path="/myicons" real-path="D:\Myfiles\icons" />

    2b. If using the Application server:
    The virtual directory under /forms is set with a line in the file
    <midtier_home>\forms\server\forms.conf
    that contains various lines already, like these for /jinitiator:

    # Virtual path for JInitiator downloadable executable and download page
    AliasMatch ^/forms/jinitiator/(..*) “(your_AS_home)/jinit/$1”

    Add your new lines under it, such as:

    # Virtual path for JInitiator downloadable executable and download page 
    AliasMatch ^/forms/jinitiator/(..*) "(your_AS_home)/jinit/$1" 
    # Virtual path for ICONS (used to show icons in a form ) 
    AliasMatch ^/forms/myicons/(..*) "D:\Myfiles/icons/$1"

    3. Stop and restart the OC4J instance (DS) or HTTP Server (AS) to pick up the changes made in step 2a or 2b respectively:

    3a. If using the Developer Suite:
    Stop then start the OC4J instance:

    On MS Windows, navigate to “Stop(Start) OC4J Instance” at:
    Start>>Programs>>Oracle Developers Suite ..>>Forms Developer

    On UNIX issue:
    $ORACLE_HOME/j2ee/Devsuite/stopinst.sh (startinst.sh)

    3b. If using the Application Server:
    Either use the Application Server Control EM Website to restart the HTTP_Server
    or issue:
    <oracle_home>\opmn\bin\opmnctl restartproc process-type=HTTP_Server

    4. Check the virtual directory has been mapped correctly.
    Copy an image file, for example save.gif, in your physical directory.
    Launch the following URL in a freshly opened browser:

    This should display the gif image. If not, double check even on Windows that the case of the image filename corresponds to that used on the URL.
    Also beware of browser cache side-effects that will continue to error despite everything fine as shown after starting a fresh browser.

    If still no success then the virtual directory has not been defined properly and you need to double check your modifications. See the “Troubleshooting” section for debugging information.

    5. Indicate to the forms runtime where the icons are to be fetched.
    By default the value for the iconpath is set in the file:
    <oracle_home>\forms\java\oracle\forms\registry\Registry.dat (capital R)
    For example set:

    default.icons.iconpath=http://host:port/forms/myicons/
    default.icons.iconextension=gif

    6. Set a form to use the icon tested in step 4.
    Create a form like in step 5 of example 1 above.
    Set the following properties for the button :
    Iconic – Yes
    Icon Filename – save
    Beware: this is CASE SENSITIVE. It corresponds to the image filename. ( here without the extension .gif as it has been set as default extension in step 5 above.)

    NOTE: The “Icon Filename” property is case sensitive. When the icon is saved, make sure the case of the name in the file system and in the form property is the same.

    7. Test this form in your browser.
    If the icon does not appear on the button, check the Troubleshooting section below.

  2. Troubleshooting
    ==============

    o Check the Registry.dat for typographical errors for the “default.icons” entries set in step 5.

    o Verify the name specified in the “Icon Filename” property of the form matches the case of the file name on the file system. If the property contains “SAVE”, but the icon file name on the file system is named save.gif, the icon will not appear when you run the form.

    o If still no success, ensure no cache effect is in the way:
    a) Always start the test with a fresh browser.
    b) If using a jar possibly close all your existing, running forms and browser windows and empty JVM and browser caches:
    For JInitiator: Control Panel>>Jinitiator 1.3.1.X>>Cache>>Clear Cache
    For IE: Tools>>Internet Options>>Delete all files
    For Netscape : Edit>>Preferences>>Advanced>>Cache>>Clear Disk and Memory cache
    Close all browsers, launch the URL in a new browser window

Advertisements

About Sher khan

Senior Oracle DBA, Oracle 10g , Oracle 11g OCE ,Oracle 12C and Oracle 11g OPN certified Specialist, OCP Certified in Oracle 9i,10g , 11g and 12C. I am working in Oracle technology since 2004. Currently working in U.A.E Email: sher487@hotmail.com
This entry was posted in Oracle Application server. Bookmark the permalink.

One Response to How To Display Iconic Images Using Forms

  1. Dooguie says:

    thank you so much for your help. You saved my life… lol It work now

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s