You are correct in that the client-side objects get serialized and then submitted, where a server-side process converts them to a Java class. My understanding is that the browser itself "serializes" the fields, i.e., that it converts an object's data to a big string (I'm not familiar with the format just yet though). At that point a BeanUtils Converter class on the server can convert that string essentially to a class (probably just a Map of the fields and their values is all).
Going the other way (Java class to Javascript object) more or less boils down to calling toString() on all the class members and then generating some Javascript code with that data that is inserted into a page via a custom tag.
That's about the size of what I was proposing. If Flow does this already then it might be redundant and can just be dropped for consideration. However, I think there is still some debate to be had about whether such functionality makes sense in the core of Struts (I'm starting to think not myself, but it's probably debatable).
-- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com
Hubert Rabago wrote:
Don, Frank,
My understanding of the proposal is that its goal is to somehow convert client-side javascript objects to server side java objects, and my understanding of Struts flow is that it uses server side scripting languages in place of precompiled java classes. Am I correct on both counts? If so, are they still compatible? Wouldn't the client side objects need to be serialized and submitted to the server, where a server side object would attempt to map that into a server side class?
Hubert
On Fri, 29 Oct 2004 13:45:34 -0700, Don Brown <[EMAIL PROTECTED]> wrote:
Actually, I just wrote a web application that uses Struts 1.2.4, Struts Flow - http://struts.sf.net/flow , iBATIS database layer, and a touch of Java. Struts Flow allows you to use a Javascript function to replace a Struts action. I use iBATIS to run SQL queries and return Lists of Maps (a Map keyed by column names in the result set), then feed those Maps to the JSP. Struts Flow provides a jsobjectToMap function that lets you convert a Javascript object to a Map, and likewise, a ScriptableMap which lets you access a Map as if it was a Javascript object.
This technique let me write an entire application mostly in Javascript with very little code. The iBATIS sql map layer functioned as my DAO and the use of Maps as my data structure worked great.
If you have any questions, I'd be happy to elaborate. The bottom line is it is very possible and in fact quite easy to write a Struts app using mostly Javascript, with a smattering of Java for things like application init and more complicated algorithms.
Don
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]