On 1/24/07, Musachy Barroso <[EMAIL PROTECTED]> wrote:
Well, you can use the plugin to "send the data back", using a "json" result, instead of writing to the OutputStream directly, like Joe mentioned.
Oh, *that* plugin. Sorry. I thought you were talking about the contents of the link you had just posted, rather than the S2 plugin. I also assumed the original poster was talking about S1 rather than S2, but it could have been either. The class I mentioned will work for S1. -- Martin Cooper The plugin has a helper class to write to an stream, or build
an string from an object also. I recently added an interceptor, to populate an action from a request containing a JSON string. regards musachy Martin Cooper wrote: > On 1/23/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: >> >> I have never used Flex, but it seems like it plays nicely with JSON: > > > It does, and you don't need a plugin. If you just want to get data > back from > the server, you can send JSON and use ActionScript's 'eval' function > to turn > that into a data structure, just like you would in JavaScript. > > For rendering beans or other Java object into JSON, you might want to > take a > look at some code that Don wrote that's sitting in the Struts sandbox. > See: > > https://svn.apache.org/repos/asf/struts/sandbox/trunk/flow/src/java/org/apache/struts/flow/json/JSONSerializer.java > > > I wrote a more generalised and extensible JSON renderer at my day job, > but > I'd need to get permission before I could post that. > > -- > Martin Cooper > > > http://weblogs.macromedia.com/mesh/archives/2006/03/one_of_the_litt.html >> >> You can use the JSON plugin to serialize your actions into JSON. If you >> post this question on the user list, you'll probably get more answers >> >> regards >> musachy >> >> Joe Germuska wrote: >> > What do you mean by "just the result?" If your Flex app is calling >> > Struts, >> > then it needs some kind of data back. Are you saying that you want >> the >> > result to be ActionScript, kind of like a JSON result? Or XML? >> > >> > In the general case, if a Struts action writes data to the Servlet >> > response, >> > then it should return null. But often, an easier way to do something >> > like a >> > simple XML or JSON result is to use a JSP with a content type other >> than >> > text/html. Automatic serialization of a POJO to JSON or XML is >> probably >> > more elegant, but for a quick solution, you can render that stuff in a >> > JSP >> > -- in any case, better than writing directly to the output stream, >> > which I'd >> > generally only want to do with downloads or other binary data. >> > >> > I don't know if this helps at all... >> > >> > Joe >> > >> > >> > On 1/23/07, einundswanzig <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> Im new in Struts, in fact im pretty new in Java, but i have >> >> programmed for >> >> Coldfusion, C#/VB and Flex. Im trying to connect to a J2EE server >> with >> >> Struts on it using Flex. Flex is able to call a java component on the >> >> server >> >> and execute a method and then serialize the result and deserialize it >> in >> >> an >> >> Actionscript(scripting language of flex) object. In my imaginary app >> >> Flex >> >> will provide the View, so im trying to find a way to enable Struts to >> >> serve >> >> just a result without a JSP or HTML page, i just want the result. Oh >> god >> >> this is confusing.... >> >> -- >> >> View this message in context: >> >> http://www.nabble.com/Struts-service-facade-tf3078810.html#a8553935 >> >> Sent from the Struts - Dev mailing list archive at Nabble.com. >> >> >> >> >> >> --------------------------------------------------------------------- >> >> 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] >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]