Reputation: 26587
I need to conditionally set an attribute within JSF component tags based on a boolean's value from backing bean. How should I go for it ?
If the boolean is true then the attribute should be added/specified within the component tags or if boolean is false then that attribute shouldn't be set for that component.
Upvotes: 1
Views: 893
Reputation: 6442
You can either:
rendered="#{bean.componentRendered}"
binding="#{bean.component}"
I am not sure if it is possible to achieve what I mentioned in second option. If it is impossible, then please edit my answer.
Upvotes: 1
Reputation: 558
although your question is not very clear to me.still i will try to answer this
1)if you have to populate a value in textfield(suppose) then u can set the value in the constructor of bean class and in constructor you can check the boolean value and accordingly set the value.
2)if you dont want to show the field then you can set rendered field to false according to the requirements.
please elaborate a bit so that we can help you more
Upvotes: 0