Maxa Blog

Menu

JavaFX as JSF VDL (View Description Language)?

JavaFX is a new scripting language from Sun (I guess now from Oracle) for building Java-based rich user interfaces for the Web, mobile, desktop and even TV. There are plenty of sources on the Internet the predicted or predict the death of JavaFX. Based on what Oracle said few weeks ago, JavaFX has a bright future. We, at Exadel, after playing with JavaFX for some time (see Flamingo, JavaFX Eclipse plug-in) believe that JavaFX is actually a great language to build rich user interfaces, and not only for Java-based applications. JavaFX script can be extended to be used as a view description language (VDL) for JSF or even HTML5.

What does it mean? Well, you no longer have to mix HTML with JSF tags. The entire page is developed from JavaFX nodes (UI components), using JavaFX’s object-oriented nature. Layout it defined via JavaFX layout controls. It will be now be possible (finally) to create real visual and drag-and-drop editor for JSF.

Another very powerful feature in JavaFX is binding. Any changes in the model are automatically updated in the UI, it’s possible to extend the same to JSF. No longer you have to specify what components to render via Ajax, it will be done automatically by the application. More about this feature from Alex Smirnov’s blog.

We already have a first version of JavaFX as JSF VDL (we are still looking for better name, any suggestions?), and here is a quick example. When a button is clicked, the label Hello X is updated with the number of clicks.

18 thoughts on “JavaFX as JSF VDL (View Description Language)?”

While it’s certainly an interesting experiment, I strongly disagree with the idea. When you use JSF to render HTML pages you are basically still doing HTML. JSF puts a nice abstraction on top of this by using components which encapsulate a lot of the (rendering) complexity. Besides those components however, you still have to style/structure your pages and that’s most easily done by just using HTML/CSS. In a real JSF application you will always find a mixture of HTML tags and JSF component tags. By abstracting even further away from HTML by using a complete different language, it’s going to be even harder to create a decent look & feel.

@Paul Bakker: you will still be able to style with CSS. As for layout, you will use JavaFX layout controls. Thanks for the feedback, we are trying it out ourselves, we’ll see where it goes. The idea is not far from how GWT works.. you write in Java and get HTML/JavaScript. In this case you use JavaFX which we believe is an excellent language to build UIs.

When you mention JavaFX are you referring to using JavaFX Script as the JSF VDL? Not to be mixed up but JavaFX is the platform and JavaFX Script is the programming language.

This is certainly not as confusing like having both the word Java being used to refer to the platform and the programming language. Now that is confusing when trying to find out if its Java the programming language, or Java the platform whenever the word Java is mentioned.

> By abstracting even further away from HTML by using a complete different
> language, it’s going to be even harder to create a decent look & feel.

This reminds me of the comment I just heard in the Unsupported Operation podcast which said something like “one problem with Wicket is that the Java code drives the HTML page it should be the other way around”.

Not sure if it is completely realistic to replace/eliminate HTML when developing WebApps. GWT is trying, and it seems to be the plan for JavaFX 2.0, but I have a feeling that HTML is still needed, so Facelets is the way to go.