I am rendering a date field in XHTML using JSF. Since the value in DB is saved as null the date field values is shown as "null" in the UI. How to avoid this null?

My code is given below:

    <h:outputFormat value="{0, date, MM/dd/yyyy}"
                                        rendered="#{sysbean.xx.isfeed == '1' or (sysbean.yy== false and sysbean.details.endate!= null)}">
<f:param value="#{sysbean.details.endate}" /></h:outputFormat> 

The output I am getting is

Project Name : null

How can I avoid the value coming as "null"?

有帮助吗?

解决方案

<f:param value="#{value to check!=null?value when condition is true:
value when condition is false}" />

Checking the null at EL expression, or in the bean also you can put the inline check for null values.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top