【问题标题】:Load snippet of html in controller在控制器中加载 html 片段
【发布时间】:2010-06-28 22:49:47
【问题描述】:

我想在控制器的 action 方法中加载一个 sn-p html。有没有办法做到这一点?

我想要完成的实际上是让控制器操作使用 json 作为格式来返回我的响应(带有错误代码和其他信息)并包含从模板文件加载的 html 的 sn-p 作为 json 的一部分回应。

我的回答是这样的:

{
errCode: 200,
myHtml: "Some html portion loaded from a template file goes here"

... more data elements..
}

该操作将返回带有 'render (contentType: "text/json", data);

的响应

【问题讨论】:

    标签: grails groovy


    【解决方案1】:

    你的意思是这样的:http://mrhaki.blogspot.com/2010/05/grails-goodness-use-gsp-template-engine.html

    很难从你的问题中看出你需要帮助的地方

    【讨论】:

      猜你喜欢
      • 2016-04-03
      • 1970-01-01
      • 2011-08-30
      • 1970-01-01
      • 2011-02-16
      • 1970-01-01
      • 2019-10-02
      • 2014-02-07
      • 1970-01-01
      相关资源
      最近更新 更多