tags:

views:

36

answers:

1

Hello, I cannot 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

+3  A: 

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();
    }

    // ...
}
BalusC
Any luck with this?
BalusC