如何在 JSF 中添加条件工具提示

How to add conditional tooltip in JSF

您好,我需要根据标志值 (true/false) 在 jsf 元素中显示工具提示。

元素:

<h:outputLabel value="#{msg['dealsheet.label.nonpromoted']}" />

工具提示文本:这表示交易的状态

条件: #{ds.partialLockOutFlag}

当上述标志的值为真时,悬停时工具提示消息应该在标签上可见。

任何人都可以建议如何实现这一目标吗?

当为 true 时您可以显示您的消息,否则显示空字符串:

<h:outputLabel value="#{msg['dealsheet.label.nonpromoted']}" title="#{ds.partialLockOutFlag} ? 'This denotes the status of the deal' : '' " />