struts2 jsonplugin includeProperties 对list集合的正则配置

jsonplugin 0.32 0.34 官方下载 http://code.google.com/p/jsonplugin/

文档:http://code.google.com/p/jsonplugin/wiki/Documentation

https://cwiki.apache.org/confluence/display/WW/JSON%20Plugin

Excluding properties

Xml代码 复制代码 收藏代码
  1. <!--Resultfragment-->
  2. <resulttype="json">
  3. <paramname="excludeProperties">
  4. login.password,
  5. studentList.*\.sin
  6. </param>
  7. </result>
  8. <!--Interceptorfragment-->
  9. <interceptor-refname="json">
  10. <paramname="enableSMD">true</param>
  11. <paramname="excludeProperties">
  12. login.password,
  13. studentList.*\.sin
  14. </param>
  15. </interceptor-ref>
<!-- Result fragment --> <result type="json"> <param name="excludeProperties"> login.password, studentList.*\.sin </param> </result> <!-- Interceptor fragment --> <interceptor-ref name="json"> <param name="enableSMD">true</param> <param name="excludeProperties"> login.password, studentList.*\.sin </param> </interceptor-ref>

Including properties

Xml代码 复制代码 收藏代码
  1. <!--Resultfragment-->
  2. <resulttype="json">
  3. <paramname="includeProperties">
  4. ^entries\[\d+\]\.clientNumber,
  5. ^entries\[\d+\]\.scheduleNumber,
  6. ^entries\[\d+\]\.createUserId
  7. </param>
  8. </result>
<!-- Result fragment --> <result type="json"> <param name="includeProperties"> ^entries\[\d+\]\.clientNumber, ^entries\[\d+\]\.scheduleNumber, ^entries\[\d+\]\.createUserId </param> </result>

对集合listAttachment.*, listAttachment\[\d+\] 含义是不同的

^listAttachment.*, 指listAttachment集合对象本身

^listAttachment\[\d+\] 指listAttachment集合对象中的所有元素(集合listAttachment中装的是基本数据类型)

^listAttachment\[\d+\]\.\w+ 指listAttachment集合对象中的所有元素的所有属性(集合listAttachment中装的是对象类型)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值