有条件地呈现模板文本加粗

问题描述:

对于我的收件箱页面,在这个页面的用户将能够看到邮件,邮件将有2种类型的状态(尚未开始,IN_PROGRESS)..有条件地呈现模板文本加粗

的dataTable其中用户将能够看到所有消息将有3列:

Data, title, actions 

消息的状态来自服务。我的任务是,将BOLDED单词“NEW”添加到用户尚未打开的每条消息的标题。

打开后,状态将更改为“in_progress”,粗体字“NEW”应该消失。

或有想法insted 使用某种图标。

我迄今所做的是:

<p:column headerText="#{msg.title}"> 
    <h:outputText value="#{task.properties.bpm_status=='Not Yet Started'?'New ':''}" /> 
    <h:outputText value="#{task.properties.bpm_description}" /> 
</p:column> 

问题是,我无法正确地添加<b></b>大胆,或添加图标来代替。

我试图添加<b></b> arround'新',但我在这种情况下得到错误。

您可以使用<ui:fragment>有条件地呈现模板文本。

<ui:fragment rendered="#{task.properties.bpm_status eq 'Not Yet Started'}"> 
    <b>New</b> 
</ui:fragment> 

或者,应用样式类。

<h:outputText value="New" styleClass="new" rendered="#{task.properties.bpm_status eq 'Not Yet Started'}" /> 
.new { 
    font-weight: bold; 
} 

使用内嵌样式通过style属性是实践穷人它不是抽象的/可重复使用。

+0

为什么谷歌不能给我这个... :) 谢谢,工作得很好。 ! – iJava

+0

不客气。 – BalusC

尝试小时,使用下面的风格在"style="font-weight:bold"":标签的outputText

<h:outputText value="#{task.properties.bpm_status=='Not Yet Started'?'New ':''}" style="font-weight:bold" /> 

我尝试过了,它`为我工作