The project uses ssh and $. post of jquery to access struts2's Action. No error is reported, but no result is returned.
Now $. post returns a Collection containing the permissions <Privilege>. The permission Class Privilege is associated with the User class, that is, the set Set set in Privilege stores the User Set <User> with this permission, and the set Set set in User also saves the User's permission Set <Privilege>. The data is in the action, but the callback function is not executed and the returned data is not displayed during browser debugging. The reason is as follows:
When jquery parses the returned Collection <Privilege> Set, it will see a Set <User> in it to get the data in the Collection, however, Collection <Privilege> is returned by a method in the service. At this time, the spring transaction has ended and no data is found in Set <User>. An error occurs when jquery parses an empty set, so no data is available.
Solution: add this annotation @ JSON (serialize = false) to the getUser () method in Privilege, so that jquery will ignore the data in this set during parsing. Of course, if you want to use the data, you need to first check the data in the service and put it in the collection.