This issue that you can use rpc to invoke your onModuleLoad function.
2012/4/7 junaid <[email protected]>
>
>
> I am trying to call my Javascript method from my java in GWT below is what
> i am doing
>
> public void onModuleLoad() {
>
> jsniAlert("test")
>
> }
>
>
> private static final native void jsniAlert(String test) /*-{
>
> $wnd.alert(test);
> $wnd.testJavascript();
>
> }-*/;
>
> HelloJSNI.html (the main html class which use to open my application in
> war folder)
>
> <script type="text/javascript" language="javascript"
>
> src="hellojsni/hellojsni.nocache.js"></script>
>
> <script type="text/javascript">
>
> function testJavascript(var input){
>
> window.jsniAlert();
>
> var var1inJS = "Default value";
>
> alert("Value of Var1 = " + var1inJS);
>
> var1inJS = input;
>
> alert("Value of Var1 = " + var1inJS);
>
> var var2inJS = "Waht is the value of Var2";
>
> alert("Value of Var2 = " + var2inJS);
>
> }
>
> but when i run my application there's an exception
> javascriptexception:object doesn't support property or method
> 'testjavascript'
>
> --
> 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.
>
--
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.