Java Struts and the Web GUI II

Feature: Jakarta Struts brought discipline and a simpler backroom ops to J2EE

Motivation: Now can Struts move beyond the Web GUI

Many will argue that in n-tier design, the only arena that is more complicated than architecting the presentation layer is the design and integration of the back office middleware and transaction processing, Whole books are being written about SOA-Service Oriented Architecture and ESB-Enterprise Server Bus designs.

First, on the backside Struts helped to establish that POJO-Plain Ordinary Java Objects could be used effectively in many settings where the data binding, resource sharing, fail-over, load balancing and component creating features of EJB designs were overkill. In addition, with a little help from vendors like Borland, Exadel, Nitrox, Oracle and dozens of other Java IDE providers, it has been possible to create components from Struts frameworks which are just as readily if not more re-usable as EJBeans. Finally, Struts frameworks are object neutral and thus have supported a variety of ORM-Object Relational Mapping systems including Hibernate, Spring and JDO variants. This in turn has helped demonstrate the range of backend possibilities available in J2EE and Java processing.

Second, Struts has adopted the MVC-Model, Viewer, Controller pattern to great advantage. The results have been widespread. We have already alluded to the fact that Struts in its Model framework has been object neutral and instead concentrates on result set delivery, appropriate action state switching, and/or exception handling. The result has been a flowering of Object relational frameworks including the latest JDO developments. Model design makes Struts very "promiscuous" - able to link up with a variety of data binding frameworks. It also helped put the shine on a number of Design Pattern approaches that have gained momentum especially in Java development. One of the key ideas has been the use of declarative config.xml files to drive a Controller in highly customizable ways.

Finally, Struts broke the proprietary mold. Here is an Apache Open Source project that gained a large following of developers and corresponding prominent role in Java GUI development ahead of rival technologies from half a dozen proprietary vendors including Sun itself. Struts are the proof along with dozens of other Open Source Java technologies of the vibrancy of the Java development landscape. Struts combined JSP, Servlets and XML in ways not anticipated by a lot of professional shops.

But Struts very success has underlined three problems with Java Web applications.

Third, the richness of UI widgets and components available is limited to the standard HTML form widgets. There is movement to make XForms, with their extensibility, more browser ready with Novell and IBM funding a Mozilla/Firefox XForms engine. This has an echo in work by Novell and Oracle for XForms engines for Java and mobile apps respectively. Finally there is a working group considering a proposal for extending the current set of forms. the bottom line is that forms and component elements for Struts may very well improve; but unlike in the case of Java Server faces or Flash technology - that is not under Apache/Struts direct control.

Forth, Struts enabled UI widgets are restricted in their ability to respond to client side events and specific device and/or OS platform capabilities or lack thereof. Given the tie up with form elements, it is not likely Struts will become a major player other than in the Web GUI space. Third, Presentation Layer Problem of offline operation and network processing delays are not being effectively addressed by Java Struts solutions except perhaps those using JavaScripting options. Now this is an intriguing approach that fits relatively well in the Struts framework where Business rules and model operations are outside of Struts scope of concerns except for exception conditions and next action signals, which are critical. This may allow for a hybrid AJAX (Asynchronous JavaScript and XML) + Struts to improve response time and/or allow for some offline operations. The offline operations would however, require more commitment to a swapable Model framework by Struts.

Suffice it to say that these are real problems that current Java Struts IDEs do not address. Even more important rival technologies such as JSF, Flash and Microsoft XAML/Avalon technologies may simply pre-empt Struts and in the long term confine it to a lesser or more limited role. But in the meantime Struts is used quite extensively as can be seen by the number and caliber of Struts Java IDE implementations. Here are five, which we shall review eventually in this article (we start with the first three):


Tools supporting Struts:
Eclipse with Exadel Studio IDE
Eclipse with Nitrox Struts IDE
Oracle's JDeveloper IDE
Borland JBuilder Enterprise Edition 2005
MyEclipse with Struts Designer

Exadel Studio - Struts implementation 

Exadel Eclipse Java IDE with Struts support

Exadel Studio is free and offers extensive Struts support as a plugin into the Eclipse IDE. For $99 users get additional Struts and JSF capabilities built into Exadel Studio Pro.The Pro version adds graphical editors for Struts Tiles files, and Struts Validation files. Along with this, Pro also add debugging to Server configuration and more verification options. But the core of Struts capabilities is in the free Exadel Studio.

For example Studio gives diagram, tree and source views of the important struts-config.xml controller file.As well the Struts palette works with JSP files simplifying adding forms components there developers can also make custom Struts templates for use both at start up and in JSP includes. Finally, Studio and Pro both maintain synchronization between graphical views and source editing of associated XML and JSP files in all graphical editing. this means changes to primary files through graphical editing always runs true.

Studio also gives robust viewing of database files attached through JDBC - we were able to test MySQL and Pointbase connections. SQL Queries on the database were also viewed and tested. Studio also has Spring support but devotes a number of features to Hibernate including full graphical editor and viewing of Hibernate mappings files, content assist in Hibernate configuring files with Java source synchronization. In Studio Pro users gets additionally a diagram view of Hibernate mapping files including generation of DDL to all databases supported and default Hibernate mapping generation into Java classes.

This is one of the attractive features of Exadel - strong, multiple database support with the same for application servers. As one might expect, Exadel supports JBoss with built in start/stop/restart/debug features - but this also applies to Tomcat 3/4/5, JRun and J2EE 1.4 servers. The convenient app server restart and debug capabilities are essential for Struts development.

In sum, Exadel provides a number of graphical conveniences for developing in Struts including nifty code completion in Java, JSP and some XML. But at its heart, Exadel is coders tool. It demands good understanding of Struts, JSP, and XML frameworks from developers; but rewards them with faster and less error prone development.

Nitrox Struts IDE


I think of the M7 Nitrox Struts IDE as Eclipse in the guise of Macromedia's Dreamweaver for two reasons. Like Dreamweaver, Nitrox has dual views for several graphical editors plus the underlying source code. Change the source and the diagram is immediately resynched - and in fact Nitrox does Dreamweaver one better - it is done automatically, no need to hit a "Refresh" button. The confidence that these dual views will remain synched - and that you can edit where its more convenient and time saving is a key attraction of Nitrox.

The second Nitrox Dreamweaver-like styling is the use of wizard dialogs and graphical viewers and editors. Part of this is the Eclipse legacy which Nitrox takes advantage of. For example, the new project wizard allows for auto-generation of stubs or use of templates with associated default files, configurations and code assignments. There is a whole slew of Refactor commands that come in handy when creating business rules. As well, Nitrox AppXray feature allows very intelligent import of existing J2EE and Struts projects from other tools. This same AppXray technology is behind the consistency checking and code completion that is part of JSP, XML, and Java file editing.

But just like Exadel, Nitrox is a coders IDE. Developers certainly get a lot of help in delivering good Struts code - but there is still no substitute for good knowledge of the complete Struts framework. Also like Exadel, Nitrox offers solid application server support including Tomcat, JBoss and J2EE servers.


Oracle JDeveloper 


One hardly expects to associate Struts with Oracle. After all this is the inventors of proprietary technologies such as Oracle Forms and Reports or PL/SQL - so what are they doing supporting Open Source technology like Struts ? Well get used to it. JDeveloper has quietly become one of the premiere Java development tools and its doing so by supporting a number of Java Open Source technologies like MyFaces and Struts.

For example, I was dumbfounded to discover that JDeveloper allowed me to use any 3rd party database with a JDBC or ODBC driver in its Database Explorer view and part of the associated data binding mechanisms in JDeveloper. Just as astonishing - Oracle supporting a whole slew of third party and Open Source application servers including Tomcat, BEA Weblogic, and JBoss. The other distinctive feature about Oracle JDeveloper is the number of design tools that are built into the development environ.

Do you need to do top down design and analysis ? JDeveloper provides several UML diagramming elements including Use Case, Class/Object diagrams, Sequence and Activity charts that can be used to delineate a system. Important for Struts user is the ability to create Struts Structure diagrams. These diagrams can in turn then be used to generate the stubs and/or templates for the underlying JSP, XML, and Java code that make up a project.

It is important to note that this carries the user further along through the business rules and event management than does either Exadel or Nitrox. But on the other hand JDeveloper does not do complete MDA-like system generation. Also, JDeveloper cannot do like Sun's Java Studio Creator does. And that is deliver drag and drop layout of visual components with absolute positioning and automated data bindings. JDeveloper is truly closer to the old Visual Basic which could not do the latter either - but rather put in place most of the event handlers (but few of the exception conditions and only bits of the handler code).

In sum, JDeveloper provides solid development from a top down viewpoint; but it still demands substantial developer code completion. But in the process of getting close to MDA it shows off some of the benefits - faster refastening/redesign for greater agility in development. Also the ability of Oracle's Struts and J2EE to allow for substitution or fairly ready extension of new delivery types and mechanisms including 3rd party databases and servers. Oracle and agility - who would have thought?


Struts IDEs and tools have delivered 3 things to Java development. First, the real benefits of agile use of design patterns and uncoupled systems - agility and yet better control of development. Secondly, the decoupling of model from presentation has proven the value of having several approaches to object/relational mapping - not the one best way of OLEDB (which of course has of necessity, in back door fashion, split into several unofficial access methods). Finally, Struts has proven unequivocally the value of Open Source development right in the heart of Java tools - having delivered not only a viable but also highly popular method for doing the tough Presentation layer in Java GUI development.

But can Struts meet some of the new demands of Presentation and GUI development like fewer/shorter network traversal times, more widgets and component, and ability to be used with a wider range of devices like tablets, mobile phones and PDAs ? We have seen there are approaches available to Struts developers. The question is does a not-for-profit like Apache have the clout and will to move its user base in new directions - or is Struts like VCs and Bill Gates insist - rudderless with out the dollar/profit motive?

The Complete Struts Reference - still the best tutorial plus TLD, Configure authorities
The Struts Source - Apache has done a good job - all you need to get going in Struts

CoManter Software Consultants - All rights reserved. 1985 - 2009
P.O. Box 698
Saint Augustine, Florida, USA, 32085-0698
Translated business requirements into technical infrastructure designs through....... Six Sigma processes.