Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Problem in invoking JavaBean from Oracle 9i / Forms 6i.
Hi,
I have written a Javabean program which I invoke from Oracle Forms. The program is designed to pass a parameter from Oracle Form(Ver 6i) to the java bean and get a parameter back to the form. The Javabean is called on "When-Button-Pressed" event of a Form button. The problem is, Form doesn't seem to invoke the bean at all. There seems to be no communication between the Oracle Form and the Javabean at runtime.
On-click of the Form button though all test messages in the Form trigger are being displayed (Even message before and after the Set_Custom_Property & Get_Custome_Property). The only issue is the Form variable doesn't show the returned value from the bean.
So the big question is - Whether the bean is invoked at all or not. If YES then how to check it and if NO then how to communicate with the bean from Oracle Form. I am attaching the code of Javabean and trigger code.
Thanks & Regards,
NOTE : All the ClassPath for the JavaBean has been set properly and the Form is also recognizing the Implementation Class for the Javabean.
The Trigger Code is,
Declare setNewMsg varchar2(2000) := 'Hello World'; getData varchar2(2000); BeanHdl Item; Begin BeanHdl := find_item('Block3.MYBEAN'); If NOT ID_NULL(BeanHdl) Then Message('Before Set'); SET_CUSTOM_PROPERTY(BeanHdl,1,'setMessage',setNewMsg); Message('Before Get'); getData := GET_CUSTOM_PROPERTY(BeanHdl,1,'getMessage'); SYNCHRONIZE; Message(getData); Message('After Get'); Message(' '); Else Message('The ID is null'); Message(' '); End If; END; --------------------------------------------------------------------- The Bean Code is, --------------------------- package oracle.forms.beans; import java.awt.*; import java.io.*; import java.beans.*; import oracle.forms.ui.*; import oracle.forms.properties.*; import oracle.forms.handler.*; import oracle.ewt.lwAWT.*; public class SimpleTestBean extends VBean { public static final ID SETMESSAGE = ID.registerProperty("setMessage"); public static final ID GETMESSAGE = ID.registerProperty("getMessage"); private String msg = ""; public String newMessage() { return msg; } public Object getProperty(ID id) { try { if (id == GETMESSAGE) { return newMessage(); } return super.getProperty(id);Received on Tue May 21 2002 - 00:37:30 CDT
}
catch (Exception e) { e.printStackTrace(); return null;
}
} public boolean setProperty(ID id, Object value) { try { if (id == SETMESSAGE) { msg = (String) value; } return super.setProperty(id, value); } catch (Exception e) { e.printStackTrace(); return false;
}
} } ---------------------------------------------------------------------