« Return to Thread: Excluding properties when converting from JavaScript to Java objects

Re: Excluding properties when converting from JavaScript to Java objects

by Lance Java :: Rate this Message:

Reply to Author | View in Thread

> Using black-lists in dwr.xml only excludes properties when converting from Java objects to JavaScript objects.
Are you sure? I wasn't aware of this although the docs do only mention that getters are excluded.
http://getahead.org/dwr/server/dwrxml/converters/bean

A work around could be to have two classes for your bean. Lets call them BeanAll and BeanRestricted. BeanRestricted has only the setters you want to convert from javascript. BeanAll extends (or delegates to) BeanRestricted and has the other properties needed on the serverside.

Cheers,
Lance.

On 16/04/2008, Bruno Klava <bklava@...> wrote:
Hi,

Is there any way to exclude some object properties when converting
from JavaScript to Java objects?

Using black-lists in dwr.xml only excludes properties when converting
from Java objects to JavaScript objects.


In my application, the user can modify the data structure using gui
elements (in a way that I need a reference from each gui element to
the actual object and vice versa) so, when sending the data to be
saved in the server, I get the "Max depth exceeded when dereferencing
..." error due to the references to gui elements.

My currently workaround is to navigate through the entire structure
and, for each object, set the reference to the gui element to
"undefined". Then, after sending the structure to the server, I need
to reload it to get the references to gui elements back. (I could
store these references in temporary elements to be reassigned to the
objects after communicating with the server, but the structure is
quite complex to do so).


Any suggestion is welcome.
Bruno

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


 « Return to Thread: Excluding properties when converting from JavaScript to Java objects

LightInTheBox - Buy quality products at wholesale price