Java EE and Flex, Part 1: A compelling combination
Rich-client technology for your enterprise Java applications
By Dustin Marx, JavaWorld.com, 01/13/09
- Digg
- Reddit
- SlashDot
- Stumble
- del.icio.us
- Technorati
- dzone
Adobe Flex is becoming a popular choice for generating the client side of enterprise Java applications. In this first of two
articles, Dustin Marx demonstrates how Flex can help you deliver highly interactive user interfaces that access your Java
EE application's enterprise logic. Get a hands-on introduction to perfecting a simple Flex client, then enable it to communicate
with your Java EE server. Level: Beginner
Flex 3 gives you another choice for building browser-based UIs for your Java EE applications. If you haven't yet discovered
how simple it is to add rich clients to enterprise Java applications with Flex, this article could serve as your point of
entry. You'll find out what benefits Flex brings to the table, how to create application layouts using Flex's XML grammar,
and how to make your Flex client work with a Java EE application.
Java developers adopting Flex
We know that some Java developers are resistant to Flex as a front-end technology for Java EE, but there's a strong argument
for giving Flex a chance. Author Dustin Marx discusses the factors driving Flex adoption in the Java community in a sidebar to this hands-on article.
Before I ask you to install Flex and start putting together a sample application, let's consider the advantages of using Flex
as a client-side technology. Flex offers advantages specific to Java developers and some that are more general. We'll look
at both.
Why choose Flex?
Adopting a new technology means embracing a learning curve, which can take some convincing. Here are some general advantages
to using Flex:
- You can write Flex code once and run it in any Web browser for which a Flash Player plugin exists. None of the browser-detection
or object-detection code typical of JavaScript or Ajax applications is required.
- The target runtime (Flash Player 9 or later) is installed on more than 95 percent of Web browsers worldwide.
- Flex is based on standards. Its scripting language (ActionScript 3.0) has roots in ECMAScript (the same specification implemented
by JavaScript), and its layout language is a specific XML grammar called MXML. Familiarity with the underlying standards can
help you learn Flex with relative ease.
- Flex has a refreshingly simple mechanism for binding the property of one object in a Flex application to the property of another
object in Flex. This addictive feature is commonly referred to as property binding. (JSR 295: Beans Binding is intended to add this feature to the Java language, but it won't be included in Java SE 7.)
- You can associate the Flex-based front-end with any back-end technology using techniques that promote loose coupling. Flex
provides built-in support for communication with back-ends via both traditional HTTP and SOAP-based Web services.
- Flex provides a rich set of components, Flash effects (including animation, video, and audio), and accessibility features
that make it easy to add richness and highly fluid experiences to a Web application.
Flex for Java developers
General benefits might be enough to attract you to Flex, but there are others that are mostly or entirely aimed at Java developers.
- Digg
- Reddit
- SlashDot
- Stumble
- del.icio.us
- Technorati
- dzone
Resources
Download the Flex SDK, including the command-line compiler and debugger. A single zip file contains the Flex SDK for multiple platforms.
- Dustin's Software Development Cogitations and Speculations is the author's blog, where he writes frequently about rich Internet development with Flex and Java EE. Also syndicated on JavaWorld.
- "Comparing the Syntax of Java 5 and ActionScript 3" (Yakov Fain, Java Developer's Journal, November 2006) is a good (if dated) resource for quickly identifying similarities
between ActionScript and Java.
- "Hybridizing Java" (Bruce Eckel, Artima.com, 2007) did much to bring Flex and Java developers together. Eckel devotes a portion Thinking in Java, 4th edition (Prentice Hall PTR, 2006) to using Flex for developing a front-end for Java applications.
- "Adobe lands Sun Java rich-client CTO" (Gavin Clarke, The Register, May 2008) discusses industry changes that reflect Flex's growing popularity in the Java community.
- The Open Screen Project is an initiative to promote development of a consistent runtime environment for open Web browsing and standalone applications
taking advantage of Adobe Flash Player.
- The Flex 3.2 Language Reference provides descriptions of Flex, ActionScript, and AIR API elements along with working example source code for many of these
elements. Flex 3 Component Explorer provides examples of Flex's components and example source code demonstrating how to use those components.
- Adobe's Flex Developer Center provides resources focusing on Java and Flex integration.
- Programming ActionScript 3 is an online book that provides a freely available ActionScript 3 reference.
More from JavaWorld
enable javascriptBy Anonymous on October 28, 2009, 2:44 pmon wwe site says i need to enable java script before viewing what do i do confused
Reply | Read entire comment
Could I show a Java Class Variables using Flex components By Anonymous on September 14, 2009, 12:36 amCould I show a Java Class Variables using Flex components. Like I have a String Class variable and I want to use flex component to display it like a textbox? Please...
Reply | Read entire comment
I need different example on javaBy Anonymous on September 4, 2009, 3:45 amThis is very good exmaple. But I have one doubt. No need to configure any xml files other than web.xml? Clarigy this doubt plz.
Reply | Read entire comment
Thank you.By Anonymous on July 8, 2009, 12:42 pmThis is a very good article for someone who knows Java but is new to Flex, thanks for writing this!
Reply | Read entire comment
AwesomeBy Anonymous on July 8, 2009, 9:01 amNice article! You did a great job at pulling these materials together! I do indeed enjoy java approach to Flex and prefer it over the traditional approach taken...
Reply | Read entire comment
View all comments