Every time I call a function of my applet from my Java Script, it throws an undefined exception. And my googling hasn't helped me at all.
here is a link to the site I am am hosting it on right now: Host Site
Here is my html for the embedding the Applet:
<object type="application/x-java-applet"
id="ClientApp" name="ClientApp"
archive="Cal.jar"
width="100" height="100">
<param name="code" value="Calendar_Algorithm" />
<param name="mayscript" value="true" />
</object>
And here is my java script code:
function test(){
document.writeln("<p> "+"Test"+" </p>");
try{
var s=document.ClientApp.getGreeting();
document.writeln("<p> First: "+s+" </p>");
}catch(err){
document.writeln("<p>Error Caught 1: "+err.description+"</p>");
}
try{
var s=document.getElementById('ClientApp').getGreeting();
document.writeln("<p> Second: "+s+" </p>");
}catch(err){
document.writeln("<p>Error Caught 2: "+err.description+"</p>");
}
document.close();
}
I know it loads the applet because I can see the gui, and if it helps here is my init function
public void init() {
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JLabel lbl = new JLabel(getGreeting());
add(lbl);
}
});
} catch (Exception e) {
System.err.println("createGUI didn't complete successfully");
}
}
here is a link to my full code as well Code
I got a feeling that the error is incredibly obvious, but I just can not see it.
Any help would be great!
P.S. The Applet class files are now in a signed jar file.
Also This will be placed in the webapps folder of a tomcat server, but I am currently accessing it as a local file.
ex.printStackTrace()there, this gives more information.