JSF/IceFaces Conditional Rendering

随声附和 提交于 2019-12-24 09:55:48

问题


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?


回答1:


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.




回答2:


Turns out empty is a reserved word in faces.



来源:https://stackoverflow.com/questions/2319098/jsf-icefaces-conditional-rendering

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