我在html文件的head部分定义了一个javascript变量.例如var yourName ="Nadeem"; 现在我想在我的gwt java文件/ class /方法中使用这个变量.但它显示错误:未定义.请提出一些提示.最好的祝愿.
诀窍是使用定义变量的正确"上下文",即$wnd:
static native String getYourName() /*-{
return $wnd.yourName;
}-*/;
Run Code Online (Sandbox Code Playgroud)
请参阅http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html#writing