Wicket 多标签 ajax &页面序列化

编程入门 行业动态 更新时间:2024-10-20 16:30:01
本文介绍了Wicket 多标签 ajax &页面序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

VMWare Horizo​​n 上的 WicketAjax 有一个令人讨厌的问题.用户看到的是 ajax-links 没有按预期工作.确切地说:它们可以工作,但似乎对旧版本的页面起作用.例如,当我有一个计数器时,它似乎确实处理了 ajax 更新,但该值永远不会增加.该值存储在 Model 中,所以我认为它与页面序列化有关.

I have a nasty issue with Wicket and Ajax on VMWare Horizon. What users see is that ajax-links do not work as expected. To be exact: they work, but seem to act on a older version of the page. For example, when I have a counter, it does seems to handle an ajax-update, but the value is never increased. The value is stored in a Model so I figured it has something to do with page serialization.

我接着做了一个更简单的实验:关于 Wicket-Exmaples(参见:http://www.wicket-library/wicket-examples/ajax/on-change-ajax-behavior)有一个输入框.如果您按 enter,该值将提交到页面.这在一个浏览器标签中运行良好.

I went on to do a more simpler experiment: on the Wicket-Exmaples (see: http://www.wicket-library/wicket-examples/ajax/on-change-ajax-behavior) there is a input box. If you press enter, the value is submitted to the page. This works fine in one browser tab.

但是,如果我打开两个标签(通过在新标签中复制粘贴网址,我们称它们为 AB).我使用回车在标签 A 中提交了一个值.我刷新标签 B 并获取标签 A 中提交的值.

However, if I open two tabs (by copy-pasting the url in a new tab, let's call them A and B). I submit a value in tab A using enter. I refresh the tab B and get the value what is submitted in tab A.

发生这种情况的唯一方法似乎是他们阅读彼此的序列化页面.

The only way this can happen seems to be that they read each-other's serialized pages.

如何防止这种行为?

ps.我使用 Wicket 版本 6.19.0,wicket 示例似乎运行 6.x.ps2.我在 Chrome 中注意到了这种行为.

ps. I use Wicket version 6.19.0, the wicket examples seems to run 6.x. ps2. I noticed this behaviour in Chrome.

推荐答案

为了防止这种情况发生,您应该确保在同一页面上没有打开两个或多个选项卡(即具有相同的页面 ID).您可以使用 https://github/apache/wicket/blob/2f3b357703df3fe5c49580b3c46d4fd231208474/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java 在发生这种情况时得到通知.只需执行 setResponsePage(getPage().getClass()) 即可开始新的实例.

To prevent this you should make sure that there are no two or more tabs opened on the same page (i.e. with the same page id). You can use https://github/apache/wicket/blob/2f3b357703df3fe5c49580b3c46d4fd231208474/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java to be notified when this happens. Just do setResponsePage(getPage().getClass()) to start on a fresh instance.

这篇关于Wicket 多标签 ajax &页面序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-26 03:05:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1128983.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:页面   标签   序列化   Wicket   amp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!