3
클로저가 무엇인지 이해할 수 있습니다. 나는 아래 예를 이해할 수있다.우리가 g에서 클로저를 사용하는 이유 : select optionvalue
def list = ['a','b','c','d']
def newList = []
def clos = { it.toUpperCase() }
list.collect(newList, clos)
assert newList == ["A", "B", "C", "D"]
나는 g : select 문서를 보러 갔다. 나는 아래를 보았다.
<g:select optionKey="id" optionValue="${{it.title?.toUpperCase()}}" name="book.title" from="${bookList}" />
나는 $ {{it.title? .toUpperCase()}}를 이해하지 못했습니다.
i는 각 개체의 제목이 대문자로 변환되지만를 위해 우리가 필요한 이유를 두 번 "{}"..이 $ {it.title를 사용하여 작동하지 않는 이유
? .toUpperCase() 논리를 이해 }는
outher을 $ {} 폐쇄하지 enter link description here