Java Server Faces - Java Web GUI III
Home Tutorials Reviews Weblog

Feature: Java Server Faces is a third kick (see previous here) at the Web GUI cat
Motivation: Looking at Java Web interfaces using JSF and tools

The Web GUI interface has and continues to presents a number of problems to system architects. The problems first involve how much smarts should be deployed on the client GUI, often a desktop PC (but no longer automatically so) and how much should be implemented on the server. The rise of the browser based GUI interface has only complicated the problem because users are demanding more GUI conveniences such as tables, treeviews, video windows, and other GUI goodies while still demanding fast response time and even the convenience of offline operation.But the question remains which side of the fence - client or server is best suited to delivering these capabilities.

Also users are looking for more of their devices such as PDAs, mobile phones, and other WiFi connected devices to be able to talk and do business. But at the same time IT developers and system operators are confronted with enormous security, reliability, and sheer "keeping up with the changes" problems. In effect, there are serious Presentation Layer Problems in designing and architecting systems, just as vexing as the messaging/middleware and long transaction/data integrity problems of the other two major layers in n-tier processing.

Here is a summary of the Presentation Layer Problems:
1)multiple device support - a central server is generating the interface for potentially many different targets- a PC, a PDA, a Mobile phone, an embedded processor and display - each of varying display dimensions and processing capabilities;
2)multiple operating environs - the central server may be transmitting through to the same devices but diverse client environs with different connections, storage capacity, and operating system support and functionality;
3)broader range of GUI components - that match and go beyond what users expect on the PC desktop
4)offline operations - the client may want to work offline with the same functionality, including GUI look and feel, as they get in the online sessions;
5)network latency/roundtrip delay - the client will want to minimize the amount of delays and waits associated with refreshing screens and change of state processing - network traffic has to be minimized or made transparent;
6)same service level - system administrators want to be able to deliver the same security, reliability, availability and response time that users on the local LAN get;
7)ease of admin - system administrators want better management of the server software that delivers the n-tier applications. Admin and operations people the same ease of instant, on-demand centralized updates that prevents the problems of diverging local copies processing the same data differently.

These are an imposing set of demands for service that leave developers sometimes with near mission impossible sets of requirements. Lets look at how Java Server faces addresses some of these problems.

JSF - Java Server Faces

Java Server Faces - JSF can really be thought of as the third kick at the Java Web GUI cat. The first kick was Java Servlets which had a certain elegance and simplicity of design that is still attractive to some Web developers using Java. But the Achilles heal of Java Servlets was the need to imbed scores if not hundreds println(" ... "); statements with HTML and/or JavaScript code without creating a syntactic nightmare of which double quote belonged to which string or language. Needless to say it was not pretty - and a hopeless task for the Java-less but HTML savvy web designers.In addition, developers were confined to the HTML FORM elements and associated HTML range of devices.

Hence the second kick at the Java Web GUI cat - Java Server Pages. JSPs went the opposite way - embedding special JSP tags into otherwise HTML driven pages. It is a neat division of labor - HTML/CSS/JavaScript are responsible for layout, page formatting, and static content composition; JSPs are responsible for maintaining security, identity, state, and any dynamic data connections required. Both side may engage in business logic, validations, and analytic calculations or processing. But despite these advances, JSP did not attack the problems of multiplier devices, richer GUI widgets, response time and offline operation.

So on the third attempt, first Struts and then its successor, JSF-Java Server Faces were both built on top of JSP technology. Struts was designed to deal with organizing the creation of complex applications with multiple work/page flows dependent on business rules and diverse and unpredictable inputs and outcomes (different Forwards in Struts parlance)at each stage. JSF was built to provide a richer GUI experience including new user designed GUI widgets which could be more responsive to events and exceptions in processing while also working on a wider range of devices (think PDAs, tablets, and even mobile phones)

Java Server Faces are starting to deliver on these promises as more of the major Java IDE

            Figure 4 - Exadel Studio in Eclipse IDE with Database Explorer
are starting to support Java Server Faces in their tools with some common and unique features. Here is a partial list of tools supporting JSF-Java Server Faces:
Borland JBuilder Enterprise Edition 2005
Eclipse with Exadel Studio Pro IDE
Eclipse with Nitrox JSF IDE
IBM Rational with JSF Support
Macromedia Dreamweaver with JSTL & JSF extensions
MyEclipse with JSF Designer
Oracle's JDeveloper IDE
Sun's Java Studio Creator
But just as important has been the appearance of well over 3 dozen components, frameworks and renderkits for Java Server faces. Users can find just about as many high quality JSF components as can be found for JavaScript. These range from Open Source - Apache MyFaces to proprietary charts and well designed components from Java Chart Fx and Web Galileo among many others. See here for details on JSF components.

This generation of quality components in a relatively short period of time (JSF technology is about 2 years old) is crucial because it shows that JSF has pull power in the third party arenas. As well the signs are good on the development side as such major players as Sun through NetBeans extensions, Eclipse through plugins and Oracle through JDeveloper extensions are promoting 3rd party JSF components.

And in fact the most interesting story is how good the JSF implementations are for some major Java IDEs and specifically how they are fostering interoperability not just in JSF but among Java application servers and major databases. The remainder of this overview will be devoted to examining those IDEs and the different approaches they bring to JSF Development.

Java JSF IDEs

There is an interesting approach being taken by a number of vendors towards JSF. They are providing startup wizards , enhanced database connectivity and JSP Web Page workflows diagrams. But the emphasis is as much on coding aids as wizards and templates.

Exadel Studio Pro

The Eclipse based Exadel Pro is a good example of the Java IDE approach that emphasize good design as well as good coding support. First, Exadel supports a beefed up Eclipse Database Explorer (see first screenshot above)that allows users to not only see their database tables with columns and properties but then use that info in Hibernate or Spring based data bindings. There is also Hibernate diagramming and mapping assistance. Those same diagramming features are extended to the workflow design of JSF JSP files and faces-config.xml which can be seen in Tree, Diagram, or Source views (see screenshot immediately above). These aids help to speed up the sometimes tedious coding of data bindings in JSP apps.

This same approach of visual aids to design and coding applies to the basic JSF project setup and templates supplied by Exadel. They reduce errors by allowing either a basic stub or user defined template for use with the project start-up wizard. Alternately, Exadel has a smart import facility to load in any JSF structure from other projects or resources. Finally, JSF component icons can be imported onto specific JSP pages resulting in proper bean and template code stubs.

But all of these shortcuts are oriented along with the smart JSP editor with code completion to getting the right coding in place. The emphasis is still on developers who have good JSP, XML, and JSF editing skills. Developers are expected to know their JSF and JSP stuff and be able to work to code completion. But Exadel Studio Pro certainly gives users a great start.

Finally, not only does Exadel support almost any JDBC compliant database but also a broad range of applications servers. For example, Exadel provides full support for controlling (start/stop/restart/debug) of Tomcat, JBoss, JRun and J2EE 1.4 Servers. As well its has the deployment smarts for upto a dozen additional servers. Exadel, like Nitrox just below is still very much a coders development tool.

M7 Nitrox JSF IDE


Nitrox follows in the trading of Exadel, using the Eclipse IDE as a base for great Struts and JSF development support. Like Exadel, Nitrox has has a strong import facility, AppXray that speeds loading in of existing JSF code. Again three views are supplied, diagram, tree, and source. But Dreamweaver developers will like the approach that Nitrox has taken with dual panel view of diagram and source. The two views are instantly kept synchronized so developers can use either to make changes to JSF code (see screenshot above).

Some developers pooh-pooh this type of visual interface - calling it a crutch. This developers says "the crutch" sure seems to speed up development work. For example, Nitrox is constantly aware of all the pages and associated fields, methods, and variables in an application. Make a change to one variable name and Nitrox alerts users in the the Problem viewer where all the other Java, JSP, and XML instances of the variable are flagged.

This same deep awareness of all the resource in a JSF application carries over to the debugger with references in JSP, XML and Java files being appropriately traced. Nitrox' database explorer does not have the same capabilities of Exadel, but the dual source view plus AppXray currently commands a premium price - $499 versus Exadel's $99 per seat.

The Visual Designers:Oracle JDeveloper and Sun's Java Studio Creator

There is a second set of Java IDE tools for J2EE and JSF development that take a sort of visual MDA-Model Driven Architecture approach to JSF development. The best two exponents are Oracle's JDeveloper and Sun's Java Studio Creator.

Oracle JDeveloper, like its original sibling Borland's JBuilder, has truly expanded in scope

to cover the complete application development cycle. So UML and Flow diagrams are available and constantly synch-ed up with an evolving J2EE (or applet/application based J2SE for that matter)design. UML support includes Use Case, Class/Object Diagram (as seen above), Sequence and Activity diagrams, and non-UML Page Flow (derived from the faces-config.xml) and XML/XDB diagrams ( see screen shot below).

What makes the JDeveloper toolset so compelling is that all the different viewpoints are a)constantly synch-ed together similar to Nitrox dual view (but not as blazingly fast as Nitrox) and b) Oracle has created personalities (similar to Eclipses perspectives) for managing the various editors and tools. So yes just like Visual Studio 2005 or JBuilder 2005, JDeveloper has all the tools to manage development from design through visual layout and testing to debugging and deployment. But as well its adept synching and customizable personalities help to manage the complexity of each stage along the way.

But the truly remarkable aspect of using JDeveloper was the agnostic approach that Oracle is now taking to support other databases and application servers in JDeveloper. It is a far cry from the old proprietary approach. As users can see in the screen shot below, JDeveloper is not only supporting two 3rd party databases, Mysql and Pointbase, but also providing connections to a fairly broad range of application servers including Weblogic, Tomcat 3.x to 5.x plus JBoss 3.0.x and 3.2.x.

For development shops looking to use a top down approach, Oracle JDeveloper is a very competitive product with free tools for use for non-commercial development, otherwise $995 for commercial development and/or full product support.

Sun's Java Studio Creator has been in the unenviable position of trying to make Java Development as easy as Visual Basic once was. Of course that is a task that even Microsoft has had dubious results with Visual Basic.NET. About 8 months ago we examined JSC-Java Studio Creator for ADTMag and found it very promising. We update that look see with the new update 7 version of Java Studio Creator as shown in the screenshot below.

At first glance, JSC looks a lot like Nitrox and Exadel. And in part that is because of the NetBeans base to the tool; but also one sees as in the screen shot above, an example of the JSP page flow diagramming that is delivered by Exadel and Nitrox. However, JSC steps beyond both Exadel and Nitrox with its solid Server Navigator with capabilities to add, view, and control at least five major databases - DB2, Oracle, Pointbase, SQLServer, and Sybase. However, try as we might we still have not been able to get MySQL connection to work stably with JSC though the MySQL JDBC driver works fine in Oracle JDeveloper and Exadel.

However, the distinguishing characteristic of JSC is its drag and drop ease of development for JSP pages with JSF components as seen in the screenshot below. In many circumstances this closely approximates the old ease of development possible with VB5 or VB6 (but certainly not VB.NET). For example, in the screenshot below we have easily bound the data grid with the Travel database table. With templates it is easy to create database navigation and CRUD-Create, Read, Update, Delete operations. However, just as in the case of VB.NET, there are complexity gotchas associated with integrating with Web Services, state-session variables, or cross component links.

           Sun JSC IDE with use of Drag and Drop Text, TextArea, Data Grid components
Sun has really automated not only the Build and test but also debug process so that it is easy to track across from the server to the client hard to trace session and binding bugs. However like all n-tier tools today - the exception and error tracebacks are huge and must be gleaned for nougats of information.

The two major drawbacks to JSC is that it is not as versatile as other tools. JSC only supports JSF framework in comparison to say Borland JBuilder or Oracle JDeveloper which support Struts as well as JSF plus AWT and Swing for applet and/or application components of a system. the second drawback is the JSC only supports Sun Application Server 8 in development and some pretty rough deployment "aids" to other servers like Tomcat, JBoss, WebSphere, Weblogic, etc. Given that the new NetBeans 4.1 adds support for several popular servers and has had AWT, Swing and Struts support for sometime - there is hope JSC will incorporate these capabilities as it is built on a NetBeans Foundation. And that foundation, is very smooth and concise unlike the more unwieldy Eclipse framework which is sprouting more redundant and overlapping viewers, plugins, properties, and perspectives than one can possibly hope to keep up with. Shades of Visual Studio.NET's ever-sprouting designers, wizards, and popup dialogs.

Summary

Java Server Faces through Java IDE builders and component creators are delivering on the first 3 Web GUI demand - a much broader range of operating environ, much better components, and inching towards delivery to different devices as more robust JSF Render Kits get delivered. These are improvements over Struts.

As well, Points 6) and 7) easier deployments and administration are also marginally improved with JSF - as better deployment and server management functions are supplied in conjunction with the application server vendors. But points 4) offline operation and 5)fewer roundtrips are barely touched on with JSF - some argue the new JSF event handling model makes offline ops and network response improvement even harder to achieve.

Now these trade-offs are important because competing GUI technologies such as Flash from Macromedia and Laszlo and the surge in interest in AJAX - Asynchronous JavaScript And XML do address the issues of 4)offline operation and/or 5)improved network response time. Currently both Flash and AJAX technologies raise some ease of development, fewer components, and some deployment problems. And they also open up some new security problems that Java based technologies have already mastered.

So it is good to see the wealth of JSF tools and components being delivered. But there remain problems which will probably see hybrid solutions which meld rich client techniques like Flash and AJAX with server side presentation layers like JSF more closely.

Resources:
JSFCentral - a website devoted to JSF news, reviews and tool info.
Java201 - a general Java resource site with good Java Server Faces coverage/links
Sun's JSF Site - the source on JSF development and SDKs
AJAX Challenge - spells out the advantages and disadvantages of JavaScript versus JSF

Finally my thanks to all theOpenSourcery.com readers and commentators at the Java symposium for their recommendations for tools to use with JSF. If you have a favorite tool please send an email here to have your tool reviewed.


Top of Page  Home  Tutorials  Java GUI