Welcome!

Containers Expo Blog Authors: Zakia Bouachraoui, Pat Romanski, Yeshim Deniz, Elizabeth White, Liz McMillan

Related Topics: Java IoT

Java IoT: Article

Three RIA Tools Examined: JSF, Flex, and JavaFX

2008 is going to be an important year for Rich Internet Applications

It's essential for IT managers to consider and be aware that more than one delivery platform exists today for Rich Internet Applications. Table 1 covers three platforms and their associated technologies.

While the last two approaches still involve the browser as their foundation, each also taps into powerful virtual machines that are installed as plug-ins to deliver even richer applications.

Let's look at the choices.

JavaServer Faces
Let's start with JavaServer Faces. JSF is an open source, component-based user interface Java framework for building pure browser-based applications. JSF is also the standard technology for building Web user interfaces in the Java EE 5 stack. Pure browser-based applications mean that nothing beyond the standard browser is required to run the application. JSF components generate standard HTML markup. JSF provides a declarative approach to designing the UI. JSF components provide all the logic, as well as encapsulated HTML rendering, so the developer can concentrate on building the UI, instead of messing with low-level HTML. Out-of-the-box, JSF provides a basic set of components such as links, buttons, layout, and tables. What's more, the JSF component approach makes it the perfect technology to develop Rich Internet Applications. However, to efficiently deliver a Rich Internet Application, we have to take the component model a step further.

A popular technique for delivering RIA applications inside a Web browser is AJAX. AJAX stands for Asynchronous JavaScript and XML. It is basically a collection of existing technologies for radically changing user experience on the Web. However, manual AJAX development or the utilization of one of the JavaScript libraries is challenging and, ultimately, both are very poor options. With manual development, it's not uncommon to spend a significant amount of time battling JavaScript browser incompatibilities. Finally, and probably most importantly, manual AJAX coding doesn't fit the JSF component model.

Nevertheless, all is not hopeless. Due to JSF's extensibility and its component approach, combining JSF and AJAX can be done easily. That's where RichFaces comes in. RichFaces is a rich JSF component library that provides a large number of components with AJAX support. Rich components from RichFaces render all the necessary JavaScript to send an AJAX request and, at the same time, know how to partially update a part of a page when a response comes back. IT organizations can add rich functionality without writing any JavaScript code. Developers can again concentrate on UI development instead of low-level AJAX coding and JavaScript debugging (because the components' JavaScript code will have been tested in all the modern browsers).

While JSF and RichFaces are solid tools for building Rich Internet Applications, other alternatives do exist. Enterprise IT managers must understand and be aware that other delivery mediums exist for Rich Internet Applications. First, we have more than just the browser to deliver Rich Internet Applications. It's common today to look at the browser as the only vehicle for delivering Rich Internet Applications, but it isn't the only medium that should be considered.

Let's look at a quick example using JSF and RichFaces components. We are declaratively defining the UI using JSF tags. Declaratively defining the UI is easier and more natural. When this page is processed, UI components on the page will render the necessary HTML and JavaScript to be sent to the browser.

    <h:form>
   <rich:panel>

<f:facet name="header">RichFaces</f:facet>

<h:panelGrid>

    <a4j:commandButton value="Hit Me!"actionListener="#{clickBean.count}" reRender="c" />

    <h:outputText id="c" value="Number of hits: #{clickBean.numOfClicks}"/>

    </h:panelGrid>
   </rich:panel>
    </h:form>

The model behind this page is a simple POJO:

public class ClickBean {

    private Integer numOfClicks = 0;

    public Integer getNumOfClicks() {

    return numOfClicks;
    }
    public void setNumOfClicks(Integer numOfClicks) {

    this.numOfClicks = numOfClicks;
    }
    public void count(ActionEvent event) {

    numOfClicks++;
    }
}

And, finally, when the page is run in a Web browser, Figure 1 shows the result:

Note that when clicking the button, only the counter area is updated. We are not reloading the full page.


More Stories By Max Katz

Max Katz heads Developer Relations for Appery.io, a cloud-based mobile app platform. He loves trying out new and cool REST APIs in mobile apps. Max is the author of two books “Practical RichFaces” (Apress 2008, 2011), DZone MVB (Most Valuable Blogger), and is a frequent speaker at developer conferences. You can find out what Max is up to on his blog: http://maxkatz.org and Twitter: @maxkatz.

Comments (9) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Tom Van den Eynde 04/19/08 04:00:16 AM EDT

It's simple: go with Adobe Flex - it simply rocks.

DW 04/18/08 11:18:54 PM EDT

Hmmm, have you checked out the Orbeon Forms?(http://www.orbeon.com/)

Hmmm 04/02/08 01:38:47 PM EDT

Yes, XForms sounds good. PicoForms offers a solution that would work, and Yahoo has done their new mobile back end using server-side tech. An on-device XForms processor would help write portable mobile apps.

skalvi 03/25/08 07:43:14 PM EDT

If I want to write an enterprise application for my business and I want my PC user's to be able to use it as well as mobile user's, java will not work. Web start will work on the PC but not a PDA, since I would have to use a midilet. Same with flash. I would have to develop in flash lite for the PDA's. I would have to write different version of the same program for different devices. The same with GWT for the PC based version. I would have to write a seperate application for Android and the Davlik jvm. This is where JSF is most suitable, with the concept of plugable rendering kits. Why can't I just use GWT on the gphone? Maybe I can. Maybe we should hybridize JSF. So what is the best platform for write one run anywhere? anyone?

Confusion Solution 03/01/08 04:46:58 PM EST

> The number of different frameworks and libraries
> is too vast to even consider evaluating a fraction of
> them

So just use Flex instead, hehe!

Max 02/28/08 03:34:19 PM EST

@Michael: Nowhere am I comparing JSF and Flex, I'm merely discussing various technologies and delivery platforms for RIA applications. Nowhere am I saying that one is better than the other. I'm not sure why you would want to hand-code JavaScript, unless you are building a framework, doing a school project or some research. Do you consider GWT (Google Web
Toolkit) to be a good Ajax framework? They do exactly the same, they hide the JavaScript from you.

Michael 02/28/08 07:30:10 AM EST

sorry, but comparing JSF and Flex is ridiculous. JSF has nothing to do with RIA. You might say that JSF is a possibility to build Ajax apps, but then: why JSF? It is utterly unsuited for Ajax compared to other web frameworks BECAUSE it hides the JS from the dev.

Alex 02/20/08 12:59:53 PM EST

Good article. It misses one important comment though. Your JSF example has to make a server call to the pojo to increment the click counter, while both Flex and JavaFX example do not need to do this because of their stateful nature, which is very important.

Out of these three, Flash Player's UI looks better than others.

DW 02/20/08 10:07:40 AM EST

What about XHTML and XForms Offline?

IoT & Smart Cities Stories
To Really Work for Enterprises, MultiCloud Adoption Requires Far Better and Inclusive Cloud Monitoring and Cost Management … But How? Overwhelmingly, even as enterprises have adopted cloud computing and are expanding to multi-cloud computing, IT leaders remain concerned about how to monitor, manage and control costs across hybrid and multi-cloud deployments. It’s clear that traditional IT monitoring and management approaches, designed after all for on-premises data centers, are falling short in ...
The deluge of IoT sensor data collected from connected devices and the powerful AI required to make that data actionable are giving rise to a hybrid ecosystem in which cloud, on-prem and edge processes become interweaved. Attendees will learn how emerging composable infrastructure solutions deliver the adaptive architecture needed to manage this new data reality. Machine learning algorithms can better anticipate data storms and automate resources to support surges, including fully scalable GPU-c...
A valuable conference experience generates new contacts, sales leads, potential strategic partners and potential investors; helps gather competitive intelligence and even provides inspiration for new products and services. Conference Guru works with conference organizers to pass great deals to great conferences, helping you discover new conferences and increase your return on investment.
Poor data quality and analytics drive down business value. In fact, Gartner estimated that the average financial impact of poor data quality on organizations is $9.7 million per year. But bad data is much more than a cost center. By eroding trust in information, analytics and the business decisions based on these, it is a serious impediment to digital transformation.
SYS-CON Events announced today that Silicon India has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Published in Silicon Valley, Silicon India magazine is the premiere platform for CIOs to discuss their innovative enterprise solutions and allows IT vendors to learn about new solutions that can help grow their business.
We are seeing a major migration of enterprises applications to the cloud. As cloud and business use of real time applications accelerate, legacy networks are no longer able to architecturally support cloud adoption and deliver the performance and security required by highly distributed enterprises. These outdated solutions have become more costly and complicated to implement, install, manage, and maintain.SD-WAN offers unlimited capabilities for accessing the benefits of the cloud and Internet. ...
SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5–7, 2018, at the Javits Center in New York City, NY. CrowdReviews.com is a transparent online platform for determining which products and services are the best based on the opinion of the crowd. The crowd consists of Internet users that have experienced products and services first-hand and have an interest in letting other potential buye...
Business professionals no longer wonder if they'll migrate to the cloud; it's now a matter of when. The cloud environment has proved to be a major force in transitioning to an agile business model that enables quick decisions and fast implementation that solidify customer relationships. And when the cloud is combined with the power of cognitive computing, it drives innovation and transformation that achieves astounding competitive advantage.
Founded in 2000, Chetu Inc. is a global provider of customized software development solutions and IT staff augmentation services for software technology providers. By providing clients with unparalleled niche technology expertise and industry experience, Chetu has become the premiere long-term, back-end software development partner for start-ups, SMBs, and Fortune 500 companies. Chetu is headquartered in Plantation, Florida, with thirteen offices throughout the U.S. and abroad.
DXWorldEXPO LLC announced today that "IoT Now" was named media sponsor of CloudEXPO | DXWorldEXPO 2018 New York, which will take place on November 11-13, 2018 in New York City, NY. IoT Now explores the evolving opportunities and challenges facing CSPs, and it passes on some lessons learned from those who have taken the first steps in next-gen IoT services.