• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

can applet call javascript function?? HOW??

 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an applet in the browser (IE only) that when an item is selected from a JComboBox, I would like to call the javascript function of window.showModalDialog(url, window); to create a modal browser on top of the current browser. I don't want the user to return to the initial browser until they have finished with the modal browser. How do I have the applet signal javascript to call the modal dialog function when the item is selected from the JComboBox?
Also, I need to pass some data to this new page, such as file id, service name, etc. Is there anyway I can do this besides putting this data in the query string?
Thanks in advance for your help!!
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Yes you can, you have to use netscape.javascript.JSObject class to do that. Please see other postings which are similar to your query.
cheerio

------------------
Nitin S
 
verduka fox
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Will this JSObject work in IE? My application needs to work in IE only. Are there any issues with this?
Also, please address this question:
"I need to pass some data to this new page, such as file id, service name, etc. Is there anyway I can do this besides putting this data in the query string of the URL?"
Thanks for your response.

[This message has been edited by verduka fox (edited January 18, 2001).]
 
Nitin Shivaram
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Verduka,
Yes it works in IE as well. But the catch is that this class has to present on the client side. Thats not a big deal as you can bundle JSObject class along with your applet and send it over.
As far as your other question goes, u could have hidden fields, or if there is a session associated with this application, then the values can be passed via the session object.
Hope this helps !!

------------------
Nitin S
 
verduka fox
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But the catch is that this class has to present on the client side. Thats not a big deal as you can bundle JSObject class along with your applet and send it over.


Where do I get the class file from? How do I use JSObject to have the applet communicate with javascript?

As far as your other question goes, u could have hidden fields, or if there is a session associated with this application, then the values can be passed via the session object.


How would I use hidden fields? The values are set in the applet. How would I set the value in the applet to a hidden HTML element?
How do I get the applet to set values in the session object? Can you give me some sample code please?
Thanks so much for your help!
 
Nitin Shivaram
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
verduka,
JSObject class comes with the netscape browser, it will be in a file called java40.jar. Extract only JSObject.class from the jar file, i think that will be the only class file which would be useful.
To see the api for JSObject follow this link
I think i got your other question wrong, i thought u wanted to pass the values from one jsp/servlet to another.
Well you can call javascript functions from an applet using JSObject, well thats abt it.


------------------
Nitin S
 
Nitin Shivaram
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The location the the file "java40.jar" would be
c:\Program Files\Netscape\Communicator\Program\java\classes\java40.jar.
------------------
Nitin S
 
verduka fox
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I am now using the JSObject to call methods in javascript from my applet. Now my problem is that when I try to open a modal dialog using the server cannot load the page. The jsp is instantiating a bean to dynamically determine the text it should display. I tried using a static html page as the target of showModalDialog, and that worked with no problems. Is there a problem opening a jsp on the modal dialog? Or is there a problem instantiating a bean?
Here is the error text from the server when I load the jsp:
SERVER ERROR
This server has encountered an internal error which prevents it from fulfilling your request. The most likely cause is a misconfiguration. Please ask the administrator to look for messages in the server's error log.
Your help is greatly appreciated!!
 
Nitin Shivaram
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Verduka,
Well I'm sorry i cannot help you with this, I haven't worked on jsp's all that much.
 
verduka fox
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nitin,
Thanks for all your help! You started me down the right path, which I greatly appreciate.
 
Nitin Shivaram
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are welcome !!
------------------
Nitin S
 
Let's get him boys! We'll make him read this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic