Gwt window.parent不在jsni中工作

Gwt window.parent不在jsni中工作,gwt,iframe,gxt,jsni,Gwt,Iframe,Gxt,Jsni,我用的是GXT的sencha 我们有一个名为“dashboard”的web应用程序 url=localhost:8080/dashboard/ 我们有另一个名为issuetracker的Web应用程序 url=localhost:2990/issuetracker/ 现在我在issuetracker web应用程序中有了一个velocity模板,我在其中给出了以下代码 <iframe src="localhost:8080/dashboard" width="500" height="60

我用的是GXT的sencha

我们有一个名为“dashboard”的web应用程序 url=localhost:8080/dashboard/

我们有另一个名为issuetracker的Web应用程序

url=localhost:2990/issuetracker/

现在我在issuetracker web应用程序中有了一个velocity模板,我在其中给出了以下代码

<iframe src="localhost:8080/dashboard" width="500" height="600">
</iframe>

单击仪表板web应用程序中的按钮时,issuetracker应用程序的url应更改为“localhost:8080/issuetracker/issues?mqlVersion=25”。 此25值来自dashboard web应用程序

当我尝试编写jsni代码时,没有出现以下值 最顶端窗口的url,即“localhost:2990/issuetracker/”

  • $wnd.top.location
  • $wnd.top.location.href
  • $wnd.parent.location.href
  • $wnd.parent.location
  • 窗口位置
  • window.top.location.href
  • window.parent.location.href
  • window.parent.location
我哪里做错了? 任何建议

在JSNI中使用
$wnd
,而不是
窗口

Try(清除浏览器缓存)

JSNI

JSP/HTML

<script type="text/javascript">
  function changeURL() {
    try {
        window.parent.location.href = 'http://localhost:8080/issuetracker/issues?mqlVersion=25';
    } catch (e) {
        window.location.href = 'http://localhost:8080/issuetracker/issues?mqlVersion=25';
    }
  }
</script>
<div>
    <div id='myDiv'>hello</div>
    <iframe src="localhost:8080/dashboard" width="500" height="600">
    </iframe>
</div>
输出:


myDiv
的内部HTML
hello
被替换为
hi

我是否应该使用这些Window.Location.replace(url)或公共静态最终本机字符串getParentWindow()/*-{return$wnd.parent.Location.href;}-*/;如何在“Window.Location.replace()”中传递
url
?我尝试了Window.Location.replace(),并且修改了iframe url。我现在必须尝试另一个。您在Window.Location.replace()中传递了什么?修改后的url“/issues?mqlVersion=25”请记住,现在有一个带有iframe 2的浏览器。这个iframe的src指向一个GWT应用程序。3.GWT应用程序有一个iframe,在其中可以看到实际的web应用程序。所以它就像两个iframe。iframe内部的iframe依赖于您的html/jsp文件。它就像我编写的包含GWT应用程序的iframe。GWT web应用程序生成的另一个iframe。如果是这种情况,请尝试使用
$wnd.parent.parent.location.href
<div>
    <div id='myDiv'>hello</div>
    <iframe src="localhost:8080/dashboard" width="500" height="600">
    </iframe>
</div>
public static final native Element getParentElementById(String id) /*-{
    return $wnd.parent.document.getElementById(id);
}-*/;

....

public void onModuleLoad() {
     getParentElementById("myDiv").setInnerHTML("hi");
}