Home » Developer & Programmer » Forms » Trouble using "JSObject" class from a PJC (Oracle Forms , HP UX (server) windows XP (client))
Trouble using "JSObject" class from a PJC [message #397943] Tue, 14 April 2009 12:03 Go to next message
Messages: 12
Registered: January 2008
Junior Member
Hey All,

I'm trying to build a PJC that will allow me to control the opening, closing and redirection of other web windows through a Forms FMX. Although "web.Show_document" lets you open new windows, I can't close the window it opened nor can I redirect (ie reuse) the window it opened.

I'm trying to do this using the "JSObject" java class. (netscape.javascript.JSObject).

I've read up this week on how to create PJCs. I have the jar file developed, and my form is linked with the jar file and I can output text to the java console by calling a method in my java class using code like:

fbean.register_bean('DUMMY.JAVASCRIPT_BEAN', 1, 'FormsJS');
fbean.invoke( 'DUMMY.JAVASCRIPT_BEAN', 1, 'executeJS', 'test');

However, as soon as I call any method from the JSObject, it just dies. I've read some documentation on how it works, and this is how I am doing it:

//mFormsMain is a private class variable of type
//oracle.forms.engine.Main, set in the "init" routine
JSObject win = JSObject.getWindow(mFormsMain);
win.eval("alert('here i am!');");

When I execute this, I don't get the javascript alert I was hoping for, it does nothing. If I put system.out.println statements before and after the "JSObject win..." statement, the one before is printed but the one after is not. I don't see any stack traces in the java console nor does the application crash, so I am perplexed. I've tried other methods on the JSObject class and I get the same results.

Has anyone successfully used this before? Does anyone have any advice on how to do this or what I am doing wrong?

Thanks a lot.
Re: Trouble using "JSObject" class from a PJC [message #398602 is a reply to message #397943] Thu, 16 April 2009 21:15 Go to previous messageGo to next message
Messages: 10180
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Look at http://www.orafaq.com/forum/m/200388/67467/?srch=java+close+window#msg_200388 and http://www.orafaq.com/forum/m/178668/67467/?srch=java+close+window#msg_178668 and Closing / Minimizing the parent window when using separateFrame=true uses HTMLbodyAttrs=onLoad='javascript:self.moveTo(2000,2000)'

Re: Trouble using "JSObject" class from a PJC [message #398790 is a reply to message #397943] Fri, 17 April 2009 09:49 Go to previous message
Messages: 12
Registered: January 2008
Junior Member
Thanks for the advice, but I was finally able to get it to work. Using the methods outlined in chapters 9 and 10 of this pdf: http://www.oratransplant.nl/files/formsInJSF/Forms-as-Web-Components-Step-By-Step.pdf, I was able to create an "outbound javascript API". I now can open, close and redirect any other browser windows using pure javascript called from a Forms program unit.

The pdf example used "set_custom_property" instead of fbean.invoke. I was able to get it working using that method.

Thanks again.
Previous Topic: Problem with jar caching on client
Next Topic: training Forum Builder
Goto Forum:

Current Time: Wed Aug 16 10:17:31 CDT 2017

Total time taken to generate the page: 0.08685 seconds