How to bind a boolean property to the rendered attribute?
Asked Answered
U

1

5

I am using a boolean property in a JSF managed bean and depending on its value I have to render a command link on the facelet. But the problem is that facelets is showing this error:

Property 'isPlayButtonEnabled' is not found on my backing bean

So I tested the code by changing the data type of the property from boolean to String. Then facelets didn't show any error. But the command link component didn't get rendered in the view. How is this caused and how can I solve it?

Unguinous answered 15/12, 2011 at 15:25 Comment(1)
Please post some code (property, getter&setter, partial view where the property is used).Apraxia
H
15

Property 'isPlayButtonEnabled' is not found on my backing bean

Remove the is prefix in the EL expression. It's now looking for a isIsPlayButtonEnabled() method. This should do:

<h:commandButton rendered="#{bean.playButtonEnabled}" />

with

public boolean isPlayButtonEnabled() {
    return playButtonEnabled;
}
Heartsome answered 15/12, 2011 at 16:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.