开发者

null control for java server faces el

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜