Am 23.12.2011 17:05, schrieb Javix:
> @Chris: thanks again and sorry for my tone of sharpness regarding the
> community activity.
> I watched JSON technics. As far as I got it, it is just a container to keep
> your data, like a hash. So what is advantages to use it instead of
> 'renderSupport.addScript(js);' where I constructed the js function and
> passed the translated Strings. In case of JSON, I would do the same, i.e.
> passe the same values to JSON object as key-value pairs.
> 
> Something like that:
> 
> myString = new JSONObject().put("some_key",
> messages.get("app.some.key")).toString();
> 
> The only difference I see for the moment is just I would pass JSON object to
> my Jaavscript function instead of passing all the translations. But in the
> Javascript function I should do the same, - get the translations back.
> Am I right ? Or I got it wrong?
> Thks

Yes, but the big advantage is when you use JSONObject Tapestry is
encoding everything for you. Another good thing with JSON is that you
can have optional and named arguments (because you're passing a JS
object). So it's the best way to pass stuff from Java (and any other
language) to JavaScript - independent of the framework you use.
I guess most of the Ruby - JS interaction is also based on JSON.

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

Reply via email to