在GWT模块之间导航 [英] Navigate between GWT modules
问题描述
我将GWT应用程序划分为多个模块,在它们之间导航的最佳方式是什么?
I've divided my GWT app into multiple modules, what's the best way to navigate between them?
目前,我正在使用窗口.Location.assign(foo.html#bar)
但是有没有更好的方法?
Currently I'm using Window.Location.assign("foo.html#bar")
but is there a better way?
推荐答案
History.newItem
仅适用于当前模块中的历史记录。要转换到另一个页面,我认为最好的方法是使用 Window.Location.assign
。
History.newItem
only works for history within the current module. To change to another page I think the best way is to use Window.Location.assign
.
I don'不要忘记这个问题(现在可能已经修复了),但在我们的应用程序中,我们停止使用相对URL,因为它们有时会中断(我们有一条评论引用了 http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/f79e7d5e002b48f6 )。
I don't fully remember the issue (and perhaps it has been fixed now), but in our application we stopped using relative URLs as they would sometimes break (we have a comment referencing http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/f79e7d5e002b48f6).
为此,我们有一个方法可以做到以下几点:
To this end we had a method that did the following:
public void goToRelativePage(final String relativeURL) {
Window.Location.assign(GWT.getHostPageBaseURL() + relativeURL);
}
这篇关于在GWT模块之间导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!