使用json View 的 Controller 将调用与呈现域时调用的 Controller 方法相对应的json View 。
但是我想将 Controller 参数除传递给域外,还传递给json View ,以自定义域的呈现方式。
使用此功能的典型示例是以简短或详细的方式显示在索引端点中呈现的域。
如何使 Controller 参数传递给json View ?
最佳答案
How can I make pass the controller params to the json view?
您无需做任何事情。您可以在JSON View 中引用
params
变量。我们以这种方式提供直接访问。有关更多信息,请参见http://views.grails.org/latest/的“访问请求”部分。
关于grails - 在Grails中的json View 中访问 Controller 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53061046/