maxim.porges
06-01-2005, 08:33 PM
I'm relatively new to Laszlo, and having recently sussed out the Java/RPC capabilities, I'm interested in creating a Laszlo application that uses objects instead of XML.
My intent is to create a service layer object that exposes service methods to Laszlo. Behind the scenes, this service layer object would wrap calls to my object model. Data would be returned to Laszlo as POJOs, and Laszlo would render its views and act upon the data returned from the service layer by retrieving individual data fields from the POJOs. When passing data to the service layer, method calls would be made against it using data collected by forms on the client application.
I have a few questions.
1) Would this method of working be considered bad practice? Everything I am reading about Laszlo (especially in the tutorials) seems to push using XML as the data format. However, constantly swizzling to XML strikes me as a lot of extra work if I already have POJOs available, especially with RPC being as simple to implement as it is in Laszlo.
2) How would I perform an operation such as iterating over an array of objects returned from the service layer? With XML, this is easily achieved using the <view> tag and an XPath expression in the datapath attribute, but I could see no equivalent for object collections or arrays. I considered writing my own view extension tag that can iterate objects; would this be a suitable alternative if no pre-existing solution is available?
3) Is anybody else purely using Java objects instead of XML in their Laszlo applications? If so, what have your experiences been, and what are your recommendations/cautions for this approach?
4) Is it possible to write my own Laszlo classes that will perform data binding to an object collection of some type, similar to the XML binding available when using datasets?
5) I know I can retrieve POJOs from RPC, but is it possible to instantiate POJO objects locally to send them back up the pipe to the service layer on the server over RPC? (Sorry, being lazy on this one... I know I could just try it out, but it's almost bedtime - so I'll just ask the experts :) ).
I'm looking forward to your responses and experiences as I delve deeper in to Laszlo!
Thanks,
- max
My intent is to create a service layer object that exposes service methods to Laszlo. Behind the scenes, this service layer object would wrap calls to my object model. Data would be returned to Laszlo as POJOs, and Laszlo would render its views and act upon the data returned from the service layer by retrieving individual data fields from the POJOs. When passing data to the service layer, method calls would be made against it using data collected by forms on the client application.
I have a few questions.
1) Would this method of working be considered bad practice? Everything I am reading about Laszlo (especially in the tutorials) seems to push using XML as the data format. However, constantly swizzling to XML strikes me as a lot of extra work if I already have POJOs available, especially with RPC being as simple to implement as it is in Laszlo.
2) How would I perform an operation such as iterating over an array of objects returned from the service layer? With XML, this is easily achieved using the <view> tag and an XPath expression in the datapath attribute, but I could see no equivalent for object collections or arrays. I considered writing my own view extension tag that can iterate objects; would this be a suitable alternative if no pre-existing solution is available?
3) Is anybody else purely using Java objects instead of XML in their Laszlo applications? If so, what have your experiences been, and what are your recommendations/cautions for this approach?
4) Is it possible to write my own Laszlo classes that will perform data binding to an object collection of some type, similar to the XML binding available when using datasets?
5) I know I can retrieve POJOs from RPC, but is it possible to instantiate POJO objects locally to send them back up the pipe to the service layer on the server over RPC? (Sorry, being lazy on this one... I know I could just try it out, but it's almost bedtime - so I'll just ask the experts :) ).
I'm looking forward to your responses and experiences as I delve deeper in to Laszlo!
Thanks,
- max