我想在 Controller 的action方法中加载一个html代码段。有没有办法做到这一点?
我要完成的工作实际上是让Controller操作使用json作为返回我的响应的格式(带有错误代码和其他信息),并包括从模板文件加载的html片段作为json响应的一部分。
我的回答是这样的:
{
errCode: 200,
myHtml: "Some html portion loaded from a template file goes here"
... more data elements..
}
该操作将以'render(contentType:“text / json”,data)返回响应;
最佳答案
您的意思是这样的:http://mrhaki.blogspot.com/2010/05/grails-goodness-use-gsp-template-engine.html
很难看到您需要帮助的地方
关于grails - 在 Controller 中加载HTML的代码段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3136715/