gpt4 book ai didi

jsf - JSF flash keepMessages 属性是否持续存在?

转载 作者:行者123 更新时间:2023-12-01 01:07:48 24 4
gpt4 key购买 nike

我有一个 JSF 问题,我认为可以通过添加对 FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true); 的调用来解决该问题。 .但是,我不清楚其中的一些含义。请问keepMessages房产保留true整个应用程序?

这是一个成熟的应用程序,所以我担心设置此属性会导致突然开始弹出一堆消息。如果它确实存在,有什么办法可以仅为下一次重定向设置此属性?还是我需要手动将其切换回 false某处?

最佳答案

Will the keepMessages property remain true across the application?


不,它仅适用于当前的“闪存 session ”。 IE。只是当前的 HTTP 请求。它在同一 session 的下一个请求中被清除。
另见 class' javadoc :

The Flash concept is taken from Ruby on Rails and provides a way to pass temporary objects between the user views generated by the faces lifecycle. As in Rails, anything one places in the flash will be exposed to the next view encountered by the same user session and then cleared out.


method's javadoc :

setKeepMessages

...

Parameters:

newValue - the new value for this property on this session


然而,应该注意的是,Mojarra 有几个与闪光范围相关的严重问题。例如。当您导航到不同的路径时,该消息不会出现。或者,当您碰巧导航到同一路径时,该消息将重新出现在不同的窗口中。那种东西。然而,自 Mojarra 2.1.18 以来,所有这些问题都已得到解决。只剩下一个安全漏洞,另见 issue 2126 ,由我的同事 Arjan Tijms 发现并报告。只要您不将敏感信息放入信用卡号等闪存信息中,这就是无害的。

关于jsf - JSF flash keepMessages 属性是否持续存在?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17283884/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com