Jsf xhtml为标签输出添加条件

Jsf xhtml为标签输出添加条件,jsf,facelets,Jsf,Facelets,我想在我的网页上添加一个条件,以检查检索到的值是否为null或其他内容: xhtml 根据上面的代码,它将检查firstname是否为空,并从那里调用适当的标签在网页中打印,但似乎不起作用。有人吗?试试这个 <h:outputFormat id="welId" value="#{Bean.loginCustomer eq empty ? msg['label.welcome']} : msg['label.welcomeUser']} "> 如果没有看到您的客户和您的实际消息,就不

我想在我的网页上添加一个条件,以检查检索到的值是否为null或其他内容:

xhtml

根据上面的代码,它将检查firstname是否为空,并从那里调用适当的标签在网页中打印,但似乎不起作用。有人吗?

试试这个

<h:outputFormat id="welId" value="#{Bean.loginCustomer eq empty ? msg['label.welcome']} : msg['label.welcomeUser']} ">

如果没有看到您的
客户和您的实际消息,就不可能给出结论性的答案,但应该接近这一点:

<div id="topbarMsg" class="topbar-msg">
    <h:panelGroup id="welId">
        <h:outputFormat rendered="#{empty Bean.loginCustomer}"
            value="#{msg['label.welcome']}" />  
        <h:outputFormat rendered="#{not empty Bean.loginCustomer}"
            value="#{msg['label.welcomeUser']} ">

            <f:param value="{Bean.loginCustomer.firstName}" />
        </h:outputFormat>
    </h:panelGroup>
</div>

<h:outputFormat id="welId" value="#{Bean.loginCustomer eq empty ? msg['label.welcome']} : msg['label.welcomeUser']} ">
<div id="topbarMsg" class="topbar-msg">
    <h:panelGroup id="welId">
        <h:outputFormat rendered="#{empty Bean.loginCustomer}"
            value="#{msg['label.welcome']}" />  
        <h:outputFormat rendered="#{not empty Bean.loginCustomer}"
            value="#{msg['label.welcomeUser']} ">

            <f:param value="{Bean.loginCustomer.firstName}" />
        </h:outputFormat>
    </h:panelGroup>
</div>