Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSF rendered only if record is null

The data shown in the table below is also displayed in my web app. With the exception of the BOOKINGNO column, which instead has an h:commandButton. The commandButton should only be rendered if the BOOKINGNO record is null on the corresponding row.

At the moment, using the code below, the buttons are not rendering.

table sample

PLOTNO SITENO ACCOMNO STARTDATE ENDDATE BOOKINGNO 16 1 10 2014-10-01 2014-10-03 <null> 21 2 2 2014-09-26 2014-09-29 923291 22 2 3 2014-10-01 2014-10-03 <null> 23 2 7 2014-09-26 2014-09-29 457235

JSF

<h:dataTable> 

    ...

    <h:column>
        <h:commandButton 
            onclick="if (!confirm('Do you want to book this holiday?')) return false"
            value="Book"
            action="#{dealsBean.book(item.plotNo)}"
            rendered="#{dealsBean.bookingNo = null}">
        </h:commandButton>
    </h:column>
/<h:dataTable>

I've tried various different rendered arguments but none seem to do what I want.

Am I getting the syntax right?

like image 516
DinosaurHunter Avatar asked Feb 14 '26 15:02

DinosaurHunter


1 Answers

You need to use == as operator

rendered="#{dealsBean.bookingNo == null}"
like image 175
Predrag Maric Avatar answered Feb 20 '26 02:02

Predrag Maric



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!