modification : I can't call it from javascript :(


On Aug 4, 10:38 pm, Luciano Broussal <[email protected]>
wrote:
> It's like the function was not available from javascript .... if it
> ask an object ...
>
> I tried window.myJavaStaticMethod(1,2) without no more success
>
> If i do
>
> public static native void exportStaticMethod() /*-{
>                 $wnd.myJavaStaticMethod =
>                   �[email protected]::sum(II);
>                 alert($wnd.myJavaStaticMethod(3,3));
>         }-*/;
>
> this show me 6 but it is not i want . I want to call it from
> javascript but the fact i get a result here means $wnd.
> myJavaStaticMethod exists but i can use it from javascript
> directly ....
>
> Hope this help
>
> Luciano
>
> On Aug 4, 10:25 pm, Luciano Broussal <[email protected]>
> wrote:
>
>
>
> > You can probably ran it , i provided all the code needed to reproduce.
>
> > I don't really know what's going wrong.
>
> > Thanks
>
> > On Aug 4, 9:33 pm, Jeff Chimene <[email protected]> wrote:
>
> > > On 08/04/2009 12:23 PM, Luciano Broussal wrote:
>
> > > > Hi Jeff,
>
> > > > I got a blank page and the myJavaStaticMethod is never called  or on
> > > > IE i got the javascript error icon on left bottom corner.
>
> > > What's the text associated with this error?
>
> > > > I don't really now what is going wrong. Can you make it work on your
> > > > side ? ...
>
> > > > Thanks
>
> > > > Luciano
>
> > > > On Aug 4, 8:31 pm, Jeff Chimene <[email protected]> wrote:
> > > >> 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(goog...)
>
> > > >>> 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