Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


How i can use a Java Bean in Forms 6i (Urgent)

Posted on 2002-06-09
Medium Priority
Last Modified: 2012-08-14
Hi my name is zeeshan i m getting problem with
using a bean on forms 6i please tell me full steps of using beans from 1 to all i'll be very thankful to him/her
Question by:zeeshan21m
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

M-Ali earned 300 total points
ID: 7065098
The following note from metalink may help you:  

Doc ID:  Note:131960.1
Subject:  Using and simulating Image Items in Web Forms

This article is being delivered in Draft form and may contain
errors.  Please use the MetaLink "Feedback" button to advise
Oracle of any issues related to this article.


Time and again customers ask for a possibility of using Image Items
in Forms when they run in the web, or, more critical, when they move
a client/server application to the web.

In this article the different possibilities will be discussed,
including the use of Java Beans.


The skill of readers may vary from casual to expert depending on which
method will be implemented.
To use an Image Item can be done by a novice.
But to implement a Java Bean that reads/writes to local files
and may also communicate with the database is more complex.

Using and simulating Image Items in Web Forms

1.) Using Image Items

    Of course using Image Items is the easiest way of displaying images
    within a Forms module, whether on the web or client/server.
    But when running on the web, there is a restriction that follows from the
    web architecture:
    The image files have to be on the Application Server rather than on the
    Client. The file path has to be specified in the local operating system
    naming style.

    Using an Image Item can be done this way:
      - create an Image Item named 'image_item' on your canvas.
      - use read_image_file call in the Forms trigger:


2.) Using a Bean Area to simulate an Image Item and load image files from a URL

    For this a Java Bean is required.

    Included below is a simple PJC that subclasses
    VBean and is small enough to require no further action such as
    providing a lightweight environment for the bean
    (for a declaration of this see extras\forms\pjc\beanarea
     on the Developer 6i CD).

    Create a file named "PitImageBean.java" from the following code in any directory.
    Compile it using javac.exe or JDeveloper (see Note.130431.1)
    to "PitImageBean.class" and copy this class file to
    ORACLE_HOME\forms60\java\oracle\forms\demos (if necessary, create this directory).

    package oracle.forms.demos;

    import java.awt.*;
    import oracle.forms.ui.*;
    import oracle.forms.handler.*;
    import oracle.forms.properties.*;

    public class PitImageBean extends VBean
      {  private static final ID IMAGEURL = ID.registerProperty("imageURL");

         private Image myImage=null;

         public void setImage(String imageURL)
           {  try
                {  myImage = Toolkit.getDefaultToolkit().getImage(new java.net.URL(imageURL));
                   System.out.println("setImage: imageURL");
              catch (Exception e)
                {  e.printStackTrace();

         public Object getProperty(ID id)
           {  try
                {  return super.getProperty(id);
              catch (Exception e)
                {  e.printStackTrace();
                   return null;

         public boolean setProperty(ID id, Object value)
           {  try
                {  if (id == IMAGEURL)
                     {  this.setImage((String)value);
                        return true;

                   return super.setProperty(id, value);
              catch (Exception e)
                {   e.printStackTrace();
                    return false;

         public void paint(Graphics g)
           {  try
                {  if(myImage!=null)
              catch (Exception e)
                {  e.printStackTrace();

    Then in Forms create a Bean Area item named "PITIMAGEBEAN" on the canvas
    and specify for the property "Implementation Class" the value

    In order to fill this Bean Area Item at runtime with an image file write the
    following PL/SQL code in a Forms trigger:

    Of course use your own Server name, virtual directory and file name in the URL.

    This solution is faster than
    using an image item and, more important, any URL can be used that is accessible from
    the Client and this is an improvement for the end user.
    This removes the restriction to use a directory on the Application Server.

    In the next chapters reading from local files and saving to the database
    will be discussed..

3.) Adding local file functionality

    Of course it would be nice for end users to load local image files directly
    into the Bean Area.

    This is a bit more complicated, because then the java code would be
    more sophisticated. Moreover, because of security reasons, copying a
    class file would not be enough.
    Instead creating and signing a JAR file is required.
    At the moment there is a bug that prevents most local file access,
    see bug 1543274 for the "writing" part of the problem.
    This bug is fixed in which is patch kit 4.

    So in this note a ready solution for this will not be given.

    As soon as the bug is fixed, it would be worth while
    to write Java code to read also from local files.

4.) Adding base table functionality

    In order to complete the original image item features it would also
    be nice to be able to save such a simulated image item to the

    At the moment there is not a way to implement this directly.
    At least the PJC would need a pair of getValue and setValue methods,
    but there is no interface within the Forms runtime
    prepared for this requirement yet.

    What of couse is possible already is to use a pair of
    invisible basetable Textitem and visible Bean Area item (as in chapter 2)
    where the Textitem is based on a varchar2 column
    and the Bean Area item is filled in the Textitem's POST-QUERY-TRIGGER
    by means of a SET_CUSTOM_PROPERTY command.

    Of course the image itself is not in the database but a reference to
    its URL.
    Maybe at the time of the increasing importance of Internet Servers
    this will be a reasonable way, too.


Note 70173.1 handles the deploying of images for iconic buttons
for Webforms
Note 2117949.6 FRM-13008 CANNOT FIND JAVA BEAN


 Copyright (c) 1995,2000 Oracle Corporation. All Rights Reserved. Legal Notices and Terms of Use.  


Expert Comment

ID: 9034209
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept M-Ali's comment as answer
Please leave any comments here within the next seven days.
EE Cleanup Volunteer

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question