On 08/04/2009 01:24 PM, Luciano Broussal wrote:
> 
> Line 49: Object expected
> Char : 9
> Code: 0
> URL : url of my jsni.html  test file

My guess is that the entire environment has not been created, hence the
"object expected" error. What I'm saying is that the GWT-generated code
that loads the $wnd.myJavaStaticMethod runs after the scripts in the
body tag.
You can try something like "if (window.sum) sum(3,3);" to prove this.

You won't usually use GWT in the style of putting scripts in the body
tag. You'll usually load the scripts via the head tag. Even when
retrofitting existing systems, this is the common technique.

> 
> HTH Help
> 
> 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