将 html 内容添加到来自 Backing Bean 的面孔消息
Add html content to faces message from Backing Bean
当某些方法 returns 想要的结果(任何方法,任何结果)到 JSF 页面时,我需要添加一个 Html 内容,就像 primefaces 使用 .
Html 添加很简单:
<div class="alert alert-success" role="alert">
<strong>Well done!</strong> You successfully read this important alert message.
</div>
但是找不到干净利落地做到这一点的方法,我读过很多像 How do I return HTML from managed bean in JSF? 这样的帖子,但是我的 bean 需要在用户执行某些操作时插入 html,例如正在提交表单结果。
另外: 有没有办法保存它并在重定向的情况下显示它,就像使用 primefaces context.getExternalContext().getFlash().setKeepMessages(true);
为什么不简单地使用 h:messages 标签?它在设计方面是完全可定制的,您可以简单地影响您的风格和 class 而无需所有周转
来源:http://www.jsftoolbox.com/documentation/help/12-TagReference/html/h_messages.html
当某些方法 returns 想要的结果(任何方法,任何结果)到 JSF 页面时,我需要添加一个 Html 内容,就像 primefaces 使用 .
Html 添加很简单:
<div class="alert alert-success" role="alert">
<strong>Well done!</strong> You successfully read this important alert message.
</div>
但是找不到干净利落地做到这一点的方法,我读过很多像 How do I return HTML from managed bean in JSF? 这样的帖子,但是我的 bean 需要在用户执行某些操作时插入 html,例如正在提交表单结果。
另外: 有没有办法保存它并在重定向的情况下显示它,就像使用 primefaces context.getExternalContext().getFlash().setKeepMessages(true);
为什么不简单地使用 h:messages 标签?它在设计方面是完全可定制的,您可以简单地影响您的风格和 class 而无需所有周转
来源:http://www.jsftoolbox.com/documentation/help/12-TagReference/html/h_messages.html