开发者

null control for java server faces el

开发者 https://www.devze.com 2023-01-18 18:04 出处:网络
I canno开发者_如何转开发t figure out how to do a null check withing a jsf attribute. Here is the error message I get:

I canno开发者_如何转开发t figure out how to do a null check withing a jsf attribute. Here is the error message I get: value="#{configTableBean.selectedRecord != null ? configTableBean.selectedRecord.description : ''}": Illegal Syntax for Set Operation

what is the proper way of checking for null?

Thanks


You're apparently attempting to avoid PropertyNotFoundException: base is null. You cannot do it that way. You need to preinstantiate the nested bean in the constructor or @PostConstruct of the managed bean.

public class ConfigTableBean {
    private SomeOtherBean selectedRecord;

    @PostConstruct
    public void init() {
        this.selectedRecord = new SomeOtherBean();
    }

    // ...
}
0

精彩评论

暂无评论...
验证码 换一张
取 消