How to return json data selectively in a struts2 action class

前端 未结 1 1410
一个人的身影
一个人的身影 2021-01-06 00:50

I have several properties with getter and setter method in one action class.

Those properties do not perform the same task. Actually, they respond to different busin

相关标签:
1条回答
  • 2021-01-06 01:06

    Struts2-JSON plugin allows you to exclude null properties

    <result type="json">
      <param name="excludeNullProperties">true</param>
    </result>
    

    or exclude certain parameters from being serialized

    <result type="json">
      <param name="excludeProperties">
        login.password,
        studentList.*\.sin
      </param>
    </result>
    

    See documentation for more details

    0 讨论(0)
提交回复
热议问题