473,811 Members | 3,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with JSobject throwing exception

hai all
I am working in a project in whihc i need to modify the dom of a
webpage and reload the page with modified dom.
so for this i thought of working with JSObject and with applet
commnication
As a sample here is the code i am working i am getting the exception as
fallows
please help me out how to modify it

HTML part
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<applet id="myapplet" width="300" height="500" code ="jsobject.clas s"
codebase=".">
<param name="InitialMo de" value="Normal">
</applet>
<script>
function f()
{
alert ("calling this frunction from java script via java ");
}
</script>

<BODY>
<input type="button" value ="from js to java"
onclick="docume nt.myapplet.doi tt()">
</BODY>
</HTML>
JAVA PART
import java.applet.*;
import netscape.javasc ript.*;
public class jsobject extends Applet {
private static final long serialVersionUI D = 1L;

public void init()
{
JSObject win = JSObject.getWin dow(this);
JSObject doc = (JSObject) win.getMember(" document");
JSObject loc = (JSObject) doc.getMember(" location");

String s = (String) loc.getMember(" href"); //
document.locati on.href
win.call("f", null); ; }
}
Here is the exception

netscape.javasc ript.JSExceptio n
at netscape.javasc ript.JSObject.g etWindow(JSObje ct.java:144)
at jsobject.init(j sobject.java:15 )
at sun.applet.Appl etPanel.run(Unk nown Source)
at java.lang.Threa d.run(Unknown Source)
I have adedd the folder for netscape.javasc ript from jdk
So how can i modify this error
thanking you in advance
nimbooin

Mar 21 '06 #1
2 4777
If there are no params for your HTML document function, just pass an empty
array instead of null value.
win.call("f", new String[] {});
Mar 22 '06 #2
VK

naveen wrote:
hai all
I am working in a project in whihc i need to modify the dom of a
webpage and reload the page with modified dom.
so for this i thought of working with JSObject and with applet
commnication
As a sample here is the code i am working i am getting the exception as
fallows
Here is the exception

netscape.javasc ript.JSExceptio n
at netscape.javasc ript.JSObject.g etWindow(JSObje ct.java:144)
at jsobject.init(j sobject.java:15 )
at sun.applet.Appl etPanel.run(Unk nown Source)
at java.lang.Threa d.run(Unknown Source)


<http://www.jibbering.c om/faq/#FAQ2_2>

Mar 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2593
by: damar | last post by:
Hi, My apology this is bit off topic; could not find a list for JSObject. I would like to call javascript function - window.screen.width - from servlet, using JSObject. Can any one give me some hints? Damar
5
1680
by: gh | last post by:
Hi, Is it true that the CLR sometimes can't throw the run time exception? Cause I have just encountered a problem that my program has some unexpected behaviours. After adding try-catch block to many pieces of code. It catches an array index out of bound exception. I am using VS.Net 2003 and is there any way to avoid this? Regards, Aaron
3
1562
by: CoreyMas | last post by:
This is what i am trying to do I have a DAL that contains all of my database connections/reads etc. I have a separate GUI layer that has my web pages I would like to pass my exception errors in my DAL to a custom web page to display to the user. Here is what I have done so far
24
1874
by: George Hester | last post by:
For awhile I have been trying to take a commercial java cube (each face is a link) and make it better. When I say better I'm referring to making the cube provide CLEARLY the destination of each link. Previously the destination only showed in the status bar (IE5+) . That matching up the face of the cube with the destination was somewhat problematic. For it's hard to have one eye cocked up and the other cocked down. So I thought I...
4
5338
by: Erwin Gabler | last post by:
Trying to validate a document with a reference to a DTD ("PUBLIC" identifier): <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE systems-description PUBLIC "-//foo/nono" ""> .... The DTD uses some kind of parameter entity with a reference to an entity file:
40
13544
by: Kevin Yu | last post by:
is it a bad programming design to throw exception in the try block then catch it??
2
8172
by: Adrian Burka | last post by:
HELP! I have written a web service, and a program in C# using Microsoft Visual C#.NET to interact with the web service. Exception handling isn't working in my application, though. One function that is called checks to see if a password is correct, and if it's not, it throws an exception with the message "Invalid password". I have exception-handling code in my application, but it doesn't catch the error I'm expecting. Instead, it...
11
1777
by: stax | last post by:
Hi, Assuming having a method that calls another method which also calls other methods and so on having a long winded tree of methods. What do I do in case it turns out everything has to be aborted? The only reasonable way I see here is to use a exception but everybody is telling exceptions should not be used for control flow. I just can't think of another reasonable way to deal with this. Are there any good books that teach how to do great...
1
3291
by: usenet | last post by:
I wrote some sample code (see below) for nested exception throwing i.e. my catch blocks are throwing exceptions of their own (for simplicity I used standard exceptions). I am getting some extraneous characters (St9) in my final output. Can anyone kindly help me interpret that please? Thanks, Ramesh
0
9726
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10647
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10384
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10395
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10130
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6887
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5553
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4338
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.