我可以使用Grails Domain Classes作为ST(StringTemplate)库的模型。
e.g。
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 :(得分:0)
如果没有看到你的Person domainClass,我问你的意思是{personInstance.firstName}而不是{personInstance.first_name}。 ST支持访问属性。