问题
I need to dynamically choose the width of a <p:panelGrid>
based on a backing bean property. However it is not working for me. I have a feeling that I have some syntax error in my code.
<p:panelGrid style="width:#{myBean.fromCCRM} ?70%:90%">
...
</p:panelGrid>
回答1:
The entire statement needs to go inside #{...}
.
style="width:#{myBean.fromCCRM ? '70%' : '90%'}"
来源:https://stackoverflow.com/questions/12292397/how-to-use-el-conditional-operator-in-jsf-component-attribute