Introduction
In this lab-oriented beginner’s tutorial, the author explores OpenLaszlo technology and explains its basic features.
Rich Internet Applications(RIA)
RIA stands for Rich Internet Applications. RIA tries to create browser-based applications,which are as rich and as responsive as stand-alone desktop applications. AJAX, Flex2 and OpenLaszlo are the three important RIA technologies.
Google Web Toolkit is an AJAX toolkit, worth serious attention from Java coders , because it wraps AJAX in familiar Java code , is free and comes from a path-breaking company.It also frees the coder from the vagaries of browser-dependent variations in implementing javascript.It is instructive to note James Gosling’s views on plain AJAX , as given below.
“Gosling: Ajax is a really funny thing. You can actually do, using Java applets, pretty much everything you can do in Ajax and you get much better portability. Ajax is a technology that at its heart has been around for quite a few years and mostly took off when they came up with a clever name, but it really suffers from the fact that here are so many flavors of JavaScript. And it’s kind of been… it’s the example that keeps convincing us that we have to be really,really careful about interoperability in the Java platform. Because when you start to get out of line, the way JavaScript did, it just causes an interoperability nightmare for developers. So, one of the things we try to do is make it so that people who are using JavaScript components don’t actually have to worry about JavaScript at all. They just see the components as kind of a black box that they can drag and drop onto their applications and they don’t have to worry about the can of worms that’s inside”.
That much, for plain AJAX vs. AJAX in JAVA wrappers.(JSF coders can make use of ICEFaces, which provides one such wrapper to be used with JSF).
Flex 2.0 and OpenLaszlo
But, Flex 2.0 and OpenLaszlo, base themselves on the ubiquitous Flash player which comes bundled with all modern and popular browsers. OpenLaszlo also depends on the presence of Flash player in browser side .But unlike Flex 2.0 which is free but not open-source, ( the Flex-IDE comes at a cost but Eclipse plug-in can be used instead..that makes Flex 2.0 also ALMOST free) OpenLaszlo is both open-source and free. Thus,both in Flex 2.0 and OpenLaszlo, browser variation problems are disposed off effectively.(However, it seems that extensions are being created to access the user’s hard disk,by scripting, so as to mimic a regular desktop application! This is a grave danger.)
How OpenLaszlo works?
Just like Flex 2.0, OpenLaszlo also begins with a source in special type of XML file( demo.lzx) for creating the GUI . There is provision for scripting also.This is compiled into a flashplayer format as swf(shockwave) file. The server then sends the swf file to the browser. As all modern browsers are already bundled with flashplayer, this swf file is displayed in browser without any special arrangement. All this is exactly similar to Flex 2.0
When we compile the laszlo xml file, we get swf file and this file is displayed in the browser. This type of using the lzx file is known as ‘SOLO’ mode. This is quite simple but if we use this method, we forego advanced features like SOAP communication etc.It may be remembered that Flex2 also has similar facility.
The better method is to use the swf thus generated ALONG with the Laszlo Application Server( LAS). The LAS can do the automatic compilation by itself, just like Tomcat compiling our JSP files.Or we can compile the lzx file separately and then place the resultant swf file within the LAS folder and use it.
The Laszlo Application Server is a j2ee-compliant web application and can be placed in Tomcat5 webapps folder. If the correct procedure is followed, the lzx file is dynamically compiled by the Laszlo server sitting on top of Tomcat server.
However, the OpenLaszlo package is not specific to Java coders only. It can be used by PHP coders too. How? Though the Laszlo Presentation Server makes use of Tomcat5, it comes bundled with its own Tomcat5.
For PHP developers on Linux platforms, installing OpenLaszlo on Linux is just unzipping the ‘tar’ file.( read ‘jar file for Windows).
To get a directory as ‘server’ and within that lps-3.3.3. This folder contains the built-in Tomcat server, OpenLaszlo servlets, samples, documentation etc. One of the special features from PHP4 onwards has been the facility to use Java objects from within PHP…… A point to ponder!
AJAX-based applications, use JavaScript to asynchronously invoke the server for other server-side operations, whereas in Flex2 and OpenLaszlo, dynamic action takes place mostly within the browser itself, like an applet.
If Flex2 and Laszlo are so much similar, what is the rationale for the open-source OpenLaszlo project? There are three reasons. The first reason is that SUN is collaborating with OpenLaszlo group to extend this technology to J2ME devices.As wireless and mobile devices are definitely emerging as dominant clients very fast,this factor alone makes OpenLaszlo ,the preferred choice for Java coders.
According to the OpenLaszlo website, “With more than 3.8 billion Java devices including 1.2 billion Java technology-powered phones in the world today, Sun has one of the most widely distributed client runtime environments.”
Another reason is that in OpenLaszlo-4 in beta stage now, the Laszlo compiler creates flashplayer file(swf) as well as DHTML file, which would make it independent of Flash player.As Flashplayer is a proprietory technology from Macromedia(Adobe), it would free the OpenLaszlo project from the ignomy of creating something ‘open’ and ‘free’ on the labours of another company’s intellectual property, though that might be free to a certian stage. Flex2 team criticizes the Laszlo project on this score and chides that Laszlo cannot utilise Flash, as efficiently as themselves , as Flash is their own brainchild.Without bias, it is not unreasonable to expect the FLOSS world to create its own ‘Flash’ and ‘Flashplayer’. (perhaps, there already are such projects?) .These are ‘political’ issues best skipped for the present.
The third reason is that Flex2 requires Flashplayer9 in the browser while Laszlo can do with even earlier versions of Flashplayer.






April 4, 2008
Tools & IDEs