How to use EL conditional operator in JSF component attribute?

倾然丶 夕夏残阳落幕 提交于 2019-12-19 04:09:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!