Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Expo on Google News


2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
SYS-CON.TV
Top Links You Must Click On


Adobe Flex 2: Development On A Budget
How to put a pretty Flash Player's face on your Web applications for free

From Farata Systems Flex Blog

My primary clients are Java shops. When I suggest using Adobe Flex 2 as a rich client tool for their Web applications, they typically ask about the cost on the server side.  Expected answer: free.

When I start telling them about really powerful features of Flex Data Services, they like it. They just do not like the licensing cost, which is very reasonable. But  Flex 2, it's too young, and some people are still in denial phase. It'll change soon, but there's got to be a free solution.  Just to get the foot in the door.  And there is one. 

I'll be using a JavaServer Page (JSP) here, but you can replace a JSP with any technology  you're comfortable with: servlets, Active Server Pages, Python, PHP et al. Whatever can spit out an XML to a Web browser should work the same way.

I'll show you a really simple application written in Flex 2 that talks to the XML producing JavaServer page. Just to make it simple, let's take  an XML with the information about employees:

<people>
  <person>
      <name>Alex Olson</name>
      <age>22</age><skills>java, HTML, SQL</skills>
  </person>
...
</people>

Now, let's hardcode this (I've got three persons) into a super simple JSP that consists of one out.println() call, where the xml should go between the double quotes:
<%out.println("..."); %>

The complete JSP looks like this (just put your XML in one line so you won't bother with string concatenations):
<%
out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?><people><person><name>Alex Olson</name><age>22</age><skills>java, HTML, SQL</skills></person><person><name>Brandon Smith</name><age>21</age><skills>PowerScript, JavaScript, ActionScript</skills></person><person><name>Jeremy Plant</name><age>20</age><skills>SQL, C++, Java</skills></person></people>");
%>

Deploy this JSP under some servlet container. I have Tomcat, so I just saved it as employees.jsp under my webapp\test  directory.  Do a sanity check to make sure that you've deployed this JSP correctly:  entering  http://localhost:8080/test/employees.jsp in your Web browser has to return the employee data.

Now comes the client part.  If you have an extra $500 laying around, purchase a license of Flex Builder from Adobe and enter the code below in its editor.  If you do not want to spend  any money,  just  type this code in any text editor and use the free command line mxmlc compiler that comes with Flex 2.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                             applicationComplete="employees.send()">
    <mx:HTTPService id="employees" useProxy="false"  method="POST"
        url="http://localhost:8080/test/employees.jsp" />

    <mx:DataGrid  dataProvider="{employees.lastResult.people.person}" width="60%">
          <mx:columns>
            <mx:DataGridColumn dataField="name" headerText="Name"/>
            <mx:DataGridColumn dataField="age" headerText="Age"/>
            <mx:DataGridColumn dataField="skills" headerText="Skills"/>                       
         </mx:columns>
    </mx:DataGrid>
</mx:Application>
 
Not too much typing, isn't it?

This code uses the  <mx:HTTPService> component that allows you to connect to a specified URL either directly or through a proxy. In my example I just specify the URL of my JSP. The data provider of my data grid uses binding (see the curly braces) and E4X syntax to parse the XML and populate this table with the elements located under the <person>  XML tag that is coming from our employees.jsp. Next month, I'll write a piece explaining Flex data binding in more details.  On the applicationComplete event, we send a request to the  HTTPService object known under id employees, and our JSP readily returns the XML, which is bound to the data grid.

Compile and run this program, and it'll show you the following:

Not a bad result for a dozen lines of  code.

Of course, it's better to be rich and healthy than poor and ill.  But my point is that even poor (or pretending to be poor) people can use Flex 2 with their existing server side Web technologies for free.
About Yakov Fain
Yakov Fain is a Managing Director of Farata Systems, consulting, training and product company. He has authored several Java books, dozens of technical articles. SYS-CON Books released his latest co-authored book , Rich Internet Applications with Adobe Flex and Java: Secrets of the Masters in Spring 2007. Sun Microsystems has nominated and awarded Yakov with the title Java Champion. He leads the Princeton Java Users Group. He is an Adobe Certified Flex Instructor. Yakov co-athored the O'Reilly book "Enterprise Application Development with Flex". He twits at twitter.com/yfain.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

I have not programmed in Open Laszlo, but the fact that it produces compiled code that runs in a Flash Player makes it much better choice for enterprise development than AJAX based tools.

What about OpenLaszlo (http://www.openlaszlo.com)? Does it look like good enough alternative solution like Flex? I think yes. What d o you think?


Your Feedback
Yakov Fain wrote: I have not programmed in Open Laszlo, but the fact that it produces compiled code that runs in a Flash Player makes it much better choice for enterprise development than AJAX based tools.
Alex wrote: What about OpenLaszlo (http://www.openlaszlo.com)? Does it look like good enough alternative solution like Flex? I think yes. What d o you think?
Enterprise Open Source Magazine Latest Stories . . .
Apache Deltacloud, the Red Hat-contributed ReSTful API that abstracts differences between clouds so services on any cloud can be managed – provided of course there’s a driver – has graduated from the Apache Foundation’s incubator and is now a full-fledged Top-Level Project (TLP). The...
With Cloud Expo 2012 New York (10th Cloud Expo) just four months away, what better time to start introducing you in greater detail to the distinguished individuals in our incredible Speaker Faculty for the technical and strategy sessions at the conference... We have technical and st...
AMD said late Tuesday that its chief sales officer Emilio Ghilardi had left the company and that CEO and president Rory Read is going to do his job while a replacement is sought. AMD didn’t say why Ghilardi left but it’s assumed Read wants his own people. Read is relatively new to th...
During the lifespan of M3 (Monitis Monitor Manager) there has always been something lacking – timers. M3 execution procedure was outlined in this previous article. The execution mentioned in the latter was a one-time-execution, whereas server monitoring requires periodic invocati...
Red Hat is putting its bought-in Gluster scale-out NAS storage technology, acquired in October, on the Amazon cloud. It’s styled Red Hat Virtual Storage Appliance for Amazon Web Services and other clouds are supposed to follow in short order.
A new episode of the screencast series is now available at the OpenNebula YouTube Channel. This screencast demonstrates the new easily-customizable self-service portal for cloud consumers. Its aim is to offer a simplified access to shared infrastructure for non-IT end users. The scree...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON Featured Whitepapers
ADS BY GOOGLE