Hi,
You example won't, unfortunately work - since the GWT compiler will
obfuscate your method name - but it's easy to work around that. Just
write a method that "places" your method name into the web page, e.g.
public native void setUp()/*-{
$wnd.staticFooInPage = function(a){
@com.google.gwt.examples.JSNIExample::staticFoo(Ljava/lang/
String;)(s);;
}
}-*/;
Now staticFooInPage is visible to your HTML. Your original method
staticFoo is just a simple Java method
public static void staticFoo(String s){
Window.alert(s);
}
then you can write you HTML sort of how you suggest but reference the
staticFooInPage JavaScript method instead, i.e.
<INPUT TYPE="submit" class="gwt-Button" value="Save"
onClick="staticFooInPage("Some String you want");">
Hope that helps!
//Adam