You're absolutely right,
but there is a "security reason", in real-world application, the
objects i get from business service, are usually JPA entities, and
putting a "full JPA entity" on the json result will lead to issues in
the case there are some properties of that object that have to kept
"hidden" to the end users.. (i.e. in the case of a "User" entity,
would a not good idea to return in the json result its hashed
password).

Your suggestion would surely lead to a "clean code" but an
unexperienced programmer might show to its website user some
information he didn't want to...




> A quick look at your tutorial makes me think you are underestimating the
> capability of the JSON plugin. It is fully capable of serializing most java
> objects to JSON. Rather than explicitly creating a hashmap, why not put the
> 'item' on the action and then set a json result with item configured as the
> root object.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to