Monday, May 31, 2010

Re: Calling Methode using JSNI failed

You should start by carefully reading the JSNI documentation:

http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html
http://googlewebtoolkit.blogspot.com/2008/07/getting-to-really-know-gwt-part-1-jsni.html

A simple JSNI method looks like this (note the specially formatted
braces, which Java sees as a comment block, and therefore ignores):

public static native void alert(String msg) /*-{
$wnd.alert(msg);
}-*/;

On May 31, 3:25 pm, malibubu <webmaster@mailball.de> wrote:
> Sorry, this was a typo.
>
> I also tried the signature
>
>   this.@de.test.Designer::sendNode(Ljava/lang/String;I)("TEST",100);
>
> with methode sendNode(String id, int x)
>
> Same problem :(
>
> On 31 Mai, 23:48, kozura <koz...@gmail.com> wrote:
>
>
>
> > Maybe try with int x and use I instead of the Integer class.  Also
> > even as is, your Integer method signature isn't quite right: land-
>
> > >lang.
>
> > On May 31, 3:15 pm, malibubu <webmas...@mailball.de> wrote:
>
> > > Hi,
>
> > > I've the following class:
>
> > > package de.test;
> > > public class Designer {
>
> > > public native void addNode() {
> > >    alert("Pre JSNI");
> > >    th...@de.test.Designer::sendNode(Ljava/lang/String;Ljava/land/
> > > Integer)("TEST",100);
> > >    alert("Post JSNI");
>
> > > }
>
> > > void sendNode(String id, Integer x) {
> > >    GWT.log("It Works!");
>
> > > }
> > > }
>
> > > If addNode() is called, the first Alert is shown. Then, the following
> > > JS-Error occurs (IE8):
>
> > > Details zum Fehler auf der Webseite
> > > Benutzer-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1;
> > > Trident/4.0)
> > > Zeitstempel: Mon, 31 May 2010 21:15:12 UTC
> > > Meldung: Das Objekt unterstützt diese Eigenschaft oder Methode nicht.
> > > Zeile: 11460
> > > Zeichen: 7
> > > Code: 0
> > > URI:http://localhost:8080/test/test/DDB7CB660FDE7BAFEE5000321CF27CD1.cach...
>
> > > Any ideas what I'm doing wrong?
>
> > > Thank you!- Zitierten Text ausblenden -
>
> > - Zitierten Text anzeigen -

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment