Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java GWT-History.getToken()总是返回空值_Java_Gwt_Browser History - Fatal编程技术网

Java GWT-History.getToken()总是返回空值

Java GWT-History.getToken()总是返回空值,java,gwt,browser-history,Java,Gwt,Browser History,我试图获取GWT应用程序中最后访问的页面。我想跳过历史上的某一页。为了获取上次访问的页面,我尝试了History.getToken()获取文档中描述的当前令牌。但它总是返回空白令牌 请帮忙。我是GWT的初级开发人员。请看一下 例如,名为page1的历史标记将添加到URL中,如下所示: http://www.example.com/com.example.gwt.HistoryExample/HistoryExample.html#page1 当应用程序想要将占位符推送到浏览器的历史堆栈上时,

我试图获取GWT应用程序中最后访问的页面。我想跳过历史上的某一页。为了获取上次访问的页面,我尝试了
History.getToken()
获取文档中描述的当前令牌。但它总是返回空白令牌

请帮忙。我是GWT的初级开发人员。

请看一下


例如,名为
page1
的历史标记将添加到URL中,如下所示:

http://www.example.com/com.example.gwt.HistoryExample/HistoryExample.html#page1
当应用程序想要将占位符推送到浏览器的历史堆栈上时,它只需调用

当用户使用back按钮时,将调用作为处理程序添加的任何对象

由应用程序根据新令牌的值恢复状态


请在您的应用程序中验证以下几点

要使用GWT历史记录支持,必须首先将
iframe
嵌入主机HTML页面。

<iframe src="javascript:''"
      id="__gwt_historyFrame"
      style="position:absolute;width:0;height:0;border:0"></iframe>

在此处找到示例代码。

首先告诉我如何设置历史标记?
// History.class
public class History {

    private static HistoryImpl impl;

    static {
      impl = GWT.create(HistoryImpl.class);
      if (!impl.init()) {
        // Set impl to null as a flag to no-op future calls.
        impl = null;

        // Tell the user.
        GWT.log("Unable to initialize the history subsystem; did you "
            + "include the history frame in your host page? Try "
            + "<iframe src=\"javascript:''\" id='__gwt_historyFrame' "
            + "style='position:absolute;width:0;height:0;border:0'>"
            + "</iframe>");
      }
    }

    public static String getToken() {
        // impl is null if you have not included the history frame in your host page
        // if impl is null then it return blank value
        return impl != null ? HistoryImpl.getToken() : "";
    }
}