zk MVC null check text box value data-bind annotation

815 views Asked by At

My page has text-boxes whose value attribute annotated as @{bean.innerbean.prop}. Here if inner bean obj is null , it throws null exception since when it does "nullobj.prop" evaluation.

I'm using MVC 'not MVVM'. How to do null check on bean.innerbean then load or save value from bean.innerbean.prop.

'bean' obj I set it as page scope.it has other props as name,tooltip etc which obviously work well to other respective annotated components.... Please let me know is the way to do "empty", == null on @{……} ..

Im using annotation(in MVC long since in my app) to bind user entered-value to be saved on the object as well loading it on AnnotateDataBinder.loadAlll() method being invoke from AnnotateDataBinderInit class doAfterCompose(). My question anyway to do null check on the annotated bean value..... EL Expression evaluated once on the page load phase thereafter it wont work

1

There are 1 answers

0
chillworld On

First of all, if you are using MVC you use the wrong annotation.

${} is used for el expressions, while @{} is used for data binding, witch is MVVM.

So if you use the correct expression you can do :

${empty bean.innerbean?'empty':bean.innerbean.prop}