更新时间:2023-11-28 09:06:16
BalusC像往常一样给出了很好的答案!
Great answer from BalusC as usual!
我只想添加,当我使用他的代码设置keepMessages属性时,它没有为会话设置,而是仅针对此请求(尽管它在Javadocs中说的是什么)。
I just want to add, when i used his code to set the keepMessages property, it was not set for the session, but only for this request (despite what it says in the Javadocs).
我将以下代码放入header.xhtml < c:set target =#{flash}property =keepMessagesvalue =true/>
I put the following code in my header.xhtml
<c:set target="#{flash}" property="keepMessages" value="true" />
现在它适用于每一页,我不必每次在背景中都需要它豆。
你需要JSTL,不要忘记将以下内容放在你的xhtml标题中: xmlns:c =http://java.sun.com/jsp/jstl/核心
Now it works on every page, without me having to set it every time i need it in the backing bean.
You need JSTL for this and dont forget to put the following in your xhtml header:
xmlns:c="http://java.sun.com/jsp/jstl/core"