JSF/IceFaces 条件渲染

发布于 2024-08-22 13:54:46 字数 472 浏览 2 评论 0原文

我正在使用 Icefaces 有条件地渲染组件,但它无法获取布尔值:

BeanCode:

    public boolean isEmpty(){
        return true;
    }
    public int getCount(){
        if (isEmpty()){
            return 0;
        }
        return 1;
    }

IceFaces

<ice:panelGroup rendered="#{coverage.empty}"> //this doesnt work 
<ice:panelGroup rendered="#{coverage.count==0}"> //this does work

错误消息: 错误解析:#{coverage.empty}

为什么 IceFaces 无法识别布尔值?

I am using Icefaces to conditonally render a component but it cant pick up the boolean:

BeanCode:

    public boolean isEmpty(){
        return true;
    }
    public int getCount(){
        if (isEmpty()){
            return 0;
        }
        return 1;
    }

IceFaces

<ice:panelGroup rendered="#{coverage.empty}"> //this doesnt work 
<ice:panelGroup rendered="#{coverage.count==0}"> //this does work

Error message:
Error Parsing: #{coverage.empty}

Why is IceFaces not recognising the boolean?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

萌︼了一个春 2024-08-29 13:54:46

正如您所说,empty 是表达式语言中的保留字。它确实是一个运营商。

它测试元素是否为 null 或空(例如,如果您的元素是 String,它会测试其值是否为 null 或<代码>“”)。

您可以在此处找到许多 EL 示例。

As you stated, empty is a reserved word in Expression Language. It is indeed an operator.

It tests if an element is null or empty (for example, if your element is a String, it tests if his value is either null or "").

You can find many example of EL here.

浪漫人生路 2024-08-29 13:54:46

事实证明,空是面孔中的保留词。

Turns out empty is a reserved word in faces.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文