Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Struts 1.3, JSON, and Action Forms

Alejandro Calbazana

2007-02-07

Replies:

Hello,

I am wondering if anyone has made use of Ajax and SON under Struts 1.3...

I'd like to make use of JSON in my Struts application in order to ease
the process of data binding Dojo widgets. I'd also like to use JSON to
serve as my client side model where changes made to a JSON graph, on the
client, could be posted back to an action for processing (validation,
persistence, etc..) on the server.

The basic setup is that my action would get a handle to a graph of
objects returned by calls to the data layer through Hibernate. The
graph would then be serialized to JSON (ugliness of this serialization
aside) and the resultant JSON representation would be shipped to a JSP.
Getting the JSON graph to a JSP is easy enough. I could simply emit the
JSON data as part of a forward. In fact, this works great in situations
where I retrieve data outside of the context of form's round trip. For
example, getting data as part of an async Ajax call to an action in
order to populate a select box.

The problem I am having is that I find it difficult to wire up an action
form for complex graphs to achieve auto form population upon form
submission. I'd like to be able to wire up my action form in such a way
that modifications made to a client side JSON representation of the form
bean (the graph) would be reflected on the server side.

Has anyone else dealt with this? Any help is appreciated.

Thanks,

Alejandro


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.