Grails域版本值作为JSON的一部分(Grails domain version value as part of JSON)

编程入门 行业动态 更新时间:2024-10-27 23:21:50
Grails域版本值作为JSON的一部分(Grails domain version value as part of JSON)

在编辑页面中,我将域对象作为JSON对象传递,以便在客户端使用jQuery进行操作。

将domainClassObject渲染为JSON

当我在客户端看到响应时(例如在firebug中),没有“version”属性。 仅缺少“版本”,所有其他值都可用。 这是什么原因以及如何在使用“as JSON”时将“version”值作为服务器响应的一部分来做什么?

谢谢。 杰伊钱德兰。

In a edit page, I am passing the domain object as JSON object to be manipulated at client side using jQuery.

render domainClassObject as JSON

When I see the response in client side (in firebug for e.g.), there is no "version" property. Only "version" is missing, all other values are available. What is the reason for this and what should I do to get the "version" value also as part of response from server when using "as JSON"

Thank You. Jay Chandran.

最满意答案

根据Grails转换器参考 :

grails.converters.json.domain.include.version(Boolean) - 如果JSON转换器默认包含域中的版本,则设置为true(默认值:false)

在Config.groovy中将此设置为true。

Per the Grails Converters reference:

grails.converters.json.domain.include.version (Boolean) - Set to true if JSON Converter should default include version from domain (default: false)

Set this to true in your Config.groovy.

更多推荐

本文发布于:2023-08-07 23:02:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466045.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:版本   JSON   Grails   part   version

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!