What does the question mark mean in GSP/Grails?

前端 未结 4 468
没有蜡笔的小新
没有蜡笔的小新 2021-01-31 14:58

I saw this in my generated GSP pages. What does the ? mean?


4条回答
  •  攒了一身酷
    2021-01-31 15:47

    This is very important feature in Groovy. If the object is null (ie, "phoneInstance" is null) then it's provide "null" value. This feature is called "Safe Navigation Operator". Simply when we use this feature , No need of checking the object("phoneInstance") is null or not.

提交回复
热议问题