R
Richard Maher
Hi,
The following is a huge variance in behaviour between Firefox and Internet
Explorer (that I think I'm seeing) when it comes to what is returned to the
JavaScript when a Java Applet method has been invoked. If someone could
explain why this may be, or if there is something that could be done at the
Applet end to make the behaviour consistent between the browsers, that would
be great. The issue is this: -
I use 'chan = document.getElementById("CornuCopiae");' to setup the
JavaScript variable 'chan' to reference my applet class and then proceed to
invoke various methods such as 'msgQue = chan.getString(0,queNameLen);' In
this case the getString() method returns queNameLen bytes (31) from a socket
stream starting at offset zero. So far everything is peachy and both IE and
FF have returned String objects containing the appropriate 31 bytes; the
problem is that IE has returned a JavaSCRIPT String object and FF has
returned a java.lang.String object.
With IE I then proceed to trim my msgQue JavaScript VARiable with
msgQue.rTrim() and it works great, but when I try the same thing with FF I
get "Unable to convert JavaScript value /^\$+/ to java value of type char"
which confuses the hell out of me! (especially when the trim() method
appears to work normally)
rTrim() is defined as per the JavaScript FAQ: -
String.prototype.rTrim =
function()
{
return this.replace(/\s+$/,'');
}
So after re-reading the error message a few times, and getting another one
that complains that some other method doesn't occur in java.lang.String, I
start testing a few things (like startsWith()) and discover that FF gives me
an in tact java.lang.String object complete with all its methods (but won't
honour my JS prototyping) but IE does some massaging and transforms the java
object to a javascipt object before handing it over. Error "Object does not
support property or method". Does that sound about right to everyone else?
If truth be told, I'd have to say I much prefer the FF version but how then
can I cast the j.l.String object as a standard JavaScript so that my script
code can work with it as any other JavaScript string? (VAR normalPlease =
fromApplet renders normalPlease as a java.lang.String object. [Even though
the construct says its a String function native code])
As always, all helpful advice and experiences appreciated.
Cheers Richard Maher
The following is a huge variance in behaviour between Firefox and Internet
Explorer (that I think I'm seeing) when it comes to what is returned to the
JavaScript when a Java Applet method has been invoked. If someone could
explain why this may be, or if there is something that could be done at the
Applet end to make the behaviour consistent between the browsers, that would
be great. The issue is this: -
I use 'chan = document.getElementById("CornuCopiae");' to setup the
JavaScript variable 'chan' to reference my applet class and then proceed to
invoke various methods such as 'msgQue = chan.getString(0,queNameLen);' In
this case the getString() method returns queNameLen bytes (31) from a socket
stream starting at offset zero. So far everything is peachy and both IE and
FF have returned String objects containing the appropriate 31 bytes; the
problem is that IE has returned a JavaSCRIPT String object and FF has
returned a java.lang.String object.
With IE I then proceed to trim my msgQue JavaScript VARiable with
msgQue.rTrim() and it works great, but when I try the same thing with FF I
get "Unable to convert JavaScript value /^\$+/ to java value of type char"
which confuses the hell out of me! (especially when the trim() method
appears to work normally)
rTrim() is defined as per the JavaScript FAQ: -
String.prototype.rTrim =
function()
{
return this.replace(/\s+$/,'');
}
So after re-reading the error message a few times, and getting another one
that complains that some other method doesn't occur in java.lang.String, I
start testing a few things (like startsWith()) and discover that FF gives me
an in tact java.lang.String object complete with all its methods (but won't
honour my JS prototyping) but IE does some massaging and transforms the java
object to a javascipt object before handing it over. Error "Object does not
support property or method". Does that sound about right to everyone else?
If truth be told, I'd have to say I much prefer the FF version but how then
can I cast the j.l.String object as a standard JavaScript so that my script
code can work with it as any other JavaScript string? (VAR normalPlease =
fromApplet renders normalPlease as a java.lang.String object. [Even though
the construct says its a String function native code])
As always, all helpful advice and experiences appreciated.
Cheers Richard Maher