2017-02-12 16 views
0

Grails 도메인 클래스를 ST (StringTemplate) 라이브러리의 모델로 사용할 수 있습니까?Grails 도메인 클래스 인 StringTemplate을 모델로 사용

String content = "Hello {personInstance.first_name}!" 
char startChar = '{' 
char endChar = '}' 
ST st = new ST(content, startChar, endChar) 
st.add("personInstance", personInstance) 
st.render() 

렌더링에서 얻은 것은 단순히 "안녕하세요"입니다. Grails Domain 클래스를 ST의 모델로 사용하려면 어댑터를 작성해야합니까?

답변

0

Person 도메인 클래스를 보지 않고 {personInstance.first_name} 대신 {personInstance.firstName}을 (를) 사용했습니다. ST는 속성 액세스를 지원합니다.

관련 문제