This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Struts and the fly likes JSON plugin ignoring some types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "JSON plugin ignoring some types" Watch "JSON plugin ignoring some types" New topic

JSON plugin ignoring some types

Emir Bugra Koksalan

Joined: Aug 23, 2012
Posts: 9

Hello everybody.
I'm using struts and json plugin. I have a class that have some properties and properties have type of org.joda.time.DateTimeFieldType. Json plugin trying to convert all classes to json and of course DAteTimeFieldType's properties too. Some properties which in the DateTimeFieldType has StandardDateTimeFieldType and this class is private and json plugin throws illegal access exception of course :'( I dont want that. Struts must not look at deep of every class.

I used xwork-conversion-properties but no good result. My xwork file is:

org.joda.time.DateTimeFieldType = org.kodmanyagha.strutsexample.StandardDateTimeFieldTypeConverter
org.joda.time.DateTimeFieldType.StandardDateTimeFieldType = org.kodmanyagha.strutsexample.StandardDateTimeFieldTypeConverter

How can I block struts when coming to DateTimeFieldType?

I will break my head at last Please help meeee
Emir Bugra Koksalan

Joined: Aug 23, 2012
Posts: 9

I forgot write the error:

Class org.apache.struts2.json.JSONWriter can not access a member of class org.joda.time.DateTimeFieldType$StandardDateTimeFieldType with modifiers "public"

I hope somebody got that error and solved...
I agree. Here's the link:
subject: JSON plugin ignoring some types
jQuery in Action, 3rd edition