【发布时间】:2017-10-03 16:32:52
【问题描述】:
我正在使用带有 History API 的 Wicket 7.x。我目前正在尝试为“onpopstate”连接一个 AjaxEventBehavior。每当我执行 history.pushState 时,我都有添加对象的代码,我的问题是我无法使用 onEvent 从 Java 端访问这些额外信息。
pushState 示例:
target.appendJavaScript("history.pushState({query: '" +
searchResults.getQueryString() + "'}, null, window.location.pathname);");
事件行为:
this.getPage().add(new AjaxEventBehavior("onpopstate")
{
@Override
protected void onEvent(AjaxRequestTarget target)
{
//code to get query defined in pushState
}
});
updateAjaxAttributes 不是解决方案,因为它仅在页面呈现时调用。当调用 popstate 时,我需要发送这些额外的数据。
【问题讨论】:
标签: java ajax wicket html5-history wicket-7