Wednesday, March 21, 2012

A namespace collision when using Java applets and ASP.NET AJAX

I use ASP.NET AJAX to get some data from a service, and a Java applet to draw the data. That works like a charm in IE. Unfortunately in Firefox I get a

Java class java.lang.String has no public field or method named "__iterator__"

error message when invloking the service from the client side. My guess is that the AtlascreateCallback script tries to call Sys.String.__iterator__, but instead Firefox gives it a reference to the Java's String class. Any ideas how to avoid that collision will be greatly appreciated.

Many thanks

I've found out what happens. The service call parameter is a string. I pass a Java String returned by the applet to the service call; that works fine in IE but breaks Firefox. If I use toString() to converto the Java String to JavaScript string, the call works fine in firefox too:

MyService.getStuff(toString(myApplet.getTheString()))

while

MyService.getStuff(myApplet.getTheString())

works only in IE.

No comments:

Post a Comment