Reputation: 89
I want to execute eval on a string "bean.data.id", but "bean.data" is null. is there any way to make this expression do not throw exception? or what is the right way to handle this? Thanks a lot!
${name?eval}
name = 'bean.data.id'
bean = {"data": null}
Upvotes: 1
Views: 77
Reputation: 31122
You could do this (assuming printing nothing on null
is fine):
${'(${name})!'?eval}
Upvotes: 2