如何在JSF组件属性中使用EL条件运算符? [英] How to use EL conditional operator in JSF component attribute?

查看:103
本文介绍了如何在JSF组件属性中使用EL条件运算符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要根据后备bean属性动态选择<p:panelGrid>的宽度.但是,它对我不起作用.我感觉自己的代码中存在语法错误.

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>

推荐答案

整个语句需要放在#{...}内部.

The entire statement needs to go inside #{...}.

style="width:#{myBean.fromCCRM ? '70%' : '90%'}"

这篇关于如何在JSF组件属性中使用EL条件运算符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆