On 08/04/2009 10:41 AM, Luciano Broussal wrote:
> 
> Hi all,
> 
> I'm fighting with JSNI for a time without success trying to call a
> java method from my javascript stuff.
> 
> 
> I did as explained online but without success :(
> 
> 
> http://code.google.com/docreader/#p(google-web-toolkit-doc-1-5)s(google-web-toolkit-doc-1-5)t(DevGuideJavaScriptNativeInterface)
> 
> 
> He is my class and html.
> 
> This makes me crazy. If someone could help me to display 1+ 2  = 3
> please.

What symptoms does this derangement exhibit?


> Thanks
> 
> Luciano
> 
> CLASS
> **********
> 
> 
> 
> package com.st.jsni.client;
> 
> import com.google.gwt.core.client.EntryPoint;
> 
> /**
>  * Entry point classes define <code>onModuleLoad()</code>.
>  */
> public class Jsni implements EntryPoint {
>       @Override
>       public void onModuleLoad() {
>               exportStaticMethod();
>       }
> 
>       public static native void exportStaticMethod() /*-{
>               $wnd.myJavaStaticMethod =
>                  @com.st.jsni.client.Jsni::sum(II);
>       }-*/;
> 
>       public static int sum(int a, int b) {
>               return a + b;
>       }
> }
> 
> 
> 
> HTML
> *************
> 
> 
> 
> <html>
>   <head>
>     <meta http-equiv="content-type" content="text/html;
> charset=UTF-8">
>     <link type="text/css" rel="stylesheet" href="Jsni.css">
>     <title>Web Application Starter Project</title>
>     <script type="text/javascript" language="javascript" src="jsni/
> jsni.nocache.js"></script>
>   </head>
> 
>   <!--                                           -->
>   <!-- The body can have arbitrary html, or      -->
>   <!-- you can leave the body empty if you want  -->
>   <!-- to create a completely dynamic UI.        -->
>   <!--                                           -->
>   <body>
> 
>     <!-- OPTIONAL: include this if you want history support -->
>     <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
> style="position:absolute;width:0;height:0;border:0"></iframe>
> 
>     <script type="text/javascript" language="javascript">
>       alert(myJavaStaticMethod(1,2));
>     </script>
>   </body>
> </html>

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

Reply via email to