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();
}
// ...
}
精彩评论