Exception format:
Class org. Apache. struts2.json. jsonwriter can not access a member of * or class com. googlecode. jsonplugin. jsonwriter can not access a member of class *
The first is the exception when struct2.1.8 is combined with JSON, and the second is the exception when struct2.1.6 is combined with JSON.
Details:
Class org. Apache. struts2.json. jsonwriter can not access a member of class oracle. JDBC. Driver. baseresultset with modifiers "public"
Explanation:
A Data Structure in a program cannot be serialized into JSON format.
Cause:
When the data in the struts2 action is converted to JSON data, the get method attributes are serialized and output to the client.Sometimes, many attributes cannot be serializedJSONData,For example, Oracle. JDBC. Driver. baseresultset. In this case, such an exception occurs when the conversion is forced.
Solution:
Add a JSON mark @ JSON (serialize = false) before the get method corresponding to the property that cannot be serialized to JSON ). This indicates that JSON does not need to be converted. Or do not write this get method at all.
Postscript:
The same method can be used to process JSON data that does not need to be output at the front end, thus reducing the amount of information for interaction between the server and the client.
You can add @ JSON (name = "status") before the get method of the attribute to be output at the front end to create an alias for this attribute, in the foreground, you can use status as the attribute name to read its value.