使用按钮作为Eclipse Rap/RWT Web应用程序中的链接



我有一些带有一些按钮的Web应用程序。当我单击一个按钮时,我想按照指向新入门点的链接。虽然我可以将标记添加到标签中,但使用按钮不可能。我发现

UrlLauncher launcher = RWT.getClient().getService( UrlLauncher.class );
launcher.openURL( "http://www.eclipse.org/" );

但这将打开一个新的选项卡/窗口,这不是所需的行为。所以:有没有一种方法可以按按下时按钮"表现"?

您可以使用此代码在当前浏览器选项卡中使用您选择的网站替换RAP应用程序:

final JavaScriptExecutor jsex = RWT.getClient().getService( JavaScriptExecutor.class );
if (jsex!=null){
  jsex.execute(
    "parent.window.location.href="http://www.eclipse.org";"
  );
}

最新更新