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 business-service requests, or they are related to different actions.
And my problem is like this:
I need to filter out the data and return only part of the properties within the property set because not all properties are necessary in a single request(action).
PS:Actually, I might have separated those actions or business logic into several classes instead of putting them into one action class. However, I think they all share the similar DAOs and services so I put them together in order to prevent redundant IOCs.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With