|Java Struts and the Web GUI II|
Feature: Jakarta Struts brought discipline and a
simpler backroom ops to J2EE
Here at theOpenSourcery, we subscribe to a contingency approach - depending on the requirements of the application the presentation layer can look simple and the back office gosh-awful - or vice versa. But there is no doubt that Jakarta Struts has helped both sides of Java n-tier development.
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 been widespread. We have already alluded to the fact that Struts in its Model framework has been object neutral and instead concentrates on resultset 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 is 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. First, the richness of UI widgets and components available is limited to the 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.
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):
Exadel Studio - Struts implementation
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
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.
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.
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 refactoring/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 ?
Top of Page Home Tutorials Java GUI Java JSF