Web Application Java Famework TechnologyThis document reviews the web application frameworks that implement Model-View-Controller architecture in Java Servlets and Java Server Pages, which are currently available. This is a high level document. There is also an evaluation of the two of the more favoured technologies. Straight-ahead Java Server Pages are compared against WebMacro HTML Templates. This document thus provides a feel of the technologies involved.
|
|
||||||||||||||||||||||||||||||
IntroductionWho needs to read this document?Technical management, engineers, and developers can read this high-level document.
Enjoy. Benefits of MVCModel/View/Controller is a name given to a software design pattern. If you are familiar with design patterns, a collection of common strategies used in software development then you will know about the benefits of this design already. A discussion of design patterns is out-of-scope of this document, however, I will summarise the benefits for those who are unfamiliar. Combining Model/View/Controller into one class or using global variables did not scale.
Separation eases maintenance in the long run.
Java MVC design is not really difficult.The basic concept of Model/View/Controller has been proven since the early 1980’s with research and implementation in Smalltalk 80. Do we need to write our own MVC architecture?There are several “kits” for templating HTML output with server side Java development. All of the best known frameworks are built MVC to some degree. At best they are immature products, the WebMacro framework seems to be the most mature, however it is incompatible with Java Server Pages. All of the them are non-standard, and are competiting with each other. None of them can be considered the de-facto standard. Therefore it would be best to avoid the wrong investment, and vendor lock-in, until the market and software practice says otherwise. The frameworks are actively being developed, and therefore are continually evolving. Moreover, it is difficult to find information about their support to the next phase of Enterprise Java Beans. For the short term I think we need to write our own simple MVC architecture since we will able to adapt it quicker to our own applications. We do not want to invest time in the wrong package. We also should avoid falling victim to the “bleeding edge”. The FrameworksWeb Macrohttp://www.webmacro.org/ Strutshttp://jakarta.apache.org/struts/index.html Velocityhttp://jakarta.apache.org/velocity/index.html Tapestryhttp://tapestry.primix.com/ Expressohttp://www.jcorporate.com/ Turbinehttp://java.apache.org/turbine/index.html What do other people say about these packagesHere are email correspondences, which I had on the SERVLET-INTEREST@java.sun.com and JSP-INTEREST @ java.sun.com mailing lists.
From peter.pilgrim@db.com
Hi
1) WebMacro I am interested if they work with Java Server Pages? Are there any others that I have missed? Sandra Cann scann@jcorporate.com Peter, I hope that you'll check out the open source Expresso Framework too at www.javacorporate.com. It has more than 25,000 downloads and a strong community of well over 2000 on the listserv. Sometime ago Adam Rossi requested information from this list, as he was doing research on Frameworks in preparation for a presentation in Baltimore. You might have a look at what he has on his site. Adam Rossi, PlatinumSolutions, Inc. adam.rossi@platinumsolutions.com
I had similar questions about a year ago.
After creating a persistence and presentation framework for a project, I knew
there must be a better way already out there. After exploring Expresso, I found a lot of extra functionality that we have found very useful on our projects. The security capabilities are excellent, including nested security groups that allow very fine-grained access control to database objects, controller objects, and Servlets/JSPs. Logging, server health, persistence, and XML messaging are some of the services that are included in the framework. These services allow you to avoid reinventing the wheel on your projects and concentrate on business logic. Our company has since contributed code to the Expresso project, and it has evolved a great deal over the past year. A new version (2.11) is now available and I would urge you to check it out. There is an active mailing list and developer community behind Expresso if you have any questions. I gave a presentation at the Harbor Java Users Group (http://www.harborjava.org) in August, which compared a few different frameworks, including Struts, WebMacro, and Expresso. You can download the slides from the presentation at http://www.platinumsolutions.com/resources.html if you are interested. Petr, petr.jiricka@netbeans.com WebMacro is not only a MVC framework, but also a template language, so it's not compatible with JSP. There is a new project called Velocity which is basically a complete rewrite of WebMacro - look at http://jakarta.apache.org/velocity/index.html. Struts is a really good framework designed on top of servlets and JSPs. It is a reference implementation of the "Model 2" architecture described in the J2EE blueprints document. This would definitely be my recommendation. I don't know much about Tapestry, but considering that the front page says that it is an alternative to JSP, I wouldn't hope in using this with JSPs. Craig.McClanahan@eng.sun.com Peter Pilgrim wrote: I don't think of them as being anti-Sun :-); however there are people in the world that have legitimate issues with some of the things that JSP allows you to do (like scriptlets, which I don't particularly like either, and is one of the major reasons I created Struts). In particular, some template framework developers take the philosophical position that the development environment should *prevent* you from mixing business logic and presentation logic. Therefore, they reject JSP because it *allows* such use, even though recommended development practices encourage you not to go that way. You might also want to remember that some of the templating solutions were actually in existence before JSP was created and standardized -- and in particular before JSP 1.1 made it possible to use custom tags in a powerful, portable, way. Won't some of these "kits" fall off the edge of the earth in a year because they are anti-JSP? Some will ... some won't. Does the market leader win 100% of the time? If so, we'd all be running Windows :-). If you go with one of these frameworks (JSP-based or not), however, you definitely want to make sure you're using an open source version so that you can continue to support your existing applications in case the developers of your framework decide to depart. That all being said, Struts is going to stay focused on developers who want to use JSP and servlet based technologies. That combination is very powerful, and (courtesy of the standardisation of the specifications) very portable across different servlet container and application server environments, especially those that also support other J2EE technologies like Enterprise JavaBeans. Craig McClanahan Justin Wells, justin@webmacro.org jwells@av.com In my view JSP has many problems. I believe that it has more merits as a marketing effort than as a development engine. In particular, I believe it was added to the Java platform in order to attract people familiar with ASP. I don't believe the ASP model is a suitable one for a language like Java. There have been long threads here in the past, and in other places, about the specific problems. The short story is that JSP lets you put your business logic into your template, and that's bad. When you try and work in a cleaner way the syntax JSP forces on you is much clumsier than that provided by the template solutions, so you wind encouraged to do the wrong thing. Most of the template solutions allow you a much cleaner separation of concerns than is possible in JSP. WebMacro in particular expects you to develop all of your program logic in back end JavaBeans, independent of the fact that you may use them in a servlet. It uses bean-like introspection to pull properties out of those beans and drop them into the template view. As for whether it will disappear--I doubt it, it's an open-source project with a large following. Even if the entire development team dropped off the face of the planet the community would continue to support it. Yes, we are going against the grain. But that's because the grain, JSP in this case, is flawed. Though it is a pretty good marketing campaign and it will likely result in lots of ASP folk moving to Java. I suppose there is some good in that. Justin Wells AltaVista Company, WebMacro Project Craig.McClanahan@eng.sun.com Justin Wells wrote: [snip] Most of the template solutions allow you a much cleaner separation of concerns than is possible in JSP. Among the many threads of conversation you will find in the archives on this topic, you will find that I disagree with Justin on this point :-). JSP, because it includes custom tags, can easily *support* the same separation of concerns that template environments like WebMacro and Velocity provide. The philosophical difference that Justin and others articulate is whether the developer should be *restricted* to only that approach. This is an entirely different kettle of fish. [snip] WebMacro in particular expects you to develop all of your program logic in back end JavaBeans, independent of the fact that you may use them in a servlet. It uses bean-like introspection to pull properties out of those beans and drop them into the template view. See, for example, Struts (<http://jakarta.apache.org/struts>) for a JSP based framework that has analogous (but not identical) approach. [snip] As for whether it will disappear--I doubt it, it's an open source project with a large following. Even if the entire development team dropped off the face of the planet the community would continue to support it. The only point I would add here is that JSP provides you choices of implementation of the specification, not just in the functionality provided by the language. For example, if you think that Tomcat's JSP engine is too slow, go use a servlet container that is faster without having to give up the language in which you wrote your pages in the first place. Craig McClanahan Justin Wells, justin@webmacro.org jwells@av.com Quoting Peter Pilgrim (peter.pilgrim@DB.COM): I appreciate WebMacro predates JSP and we will review the frameworks by trying them out. Correction on this: WebMacro does not predate JSP as a whole, it only predates the current incarnation of JSP, and any notion of JSP having a model/view/controller option. I don't agree that tag libraries are an acceptable substitute for a sound templating system, but I don't want to get into a raging flame war with Craig again--check the list archives for a very long discussion on the relative merits. There's lots of room for opinion. WebMacro Project: www.webmacro.org Justin Open Source Software IssuesAll of the "kits" are free as in open source. There is very little commercial support for all but one of them, which is not to say that any of these tools are bad. You cannot really compare these frameworks to proper close source development where there is funding and guaranteed chain of support as would expect if money changed hands. Most of open source projects have version numbers that rarely reach near 1.0. It is not unheard of that many a project will fall to the way side. Also many of the kits are apparently deliberately running against grade by being alternatives to Java Server Pages. It is difficult for small company to run against a giant like Sun Microsystems, so what chance does a small-time developer with a little framework have? What will decide these tools is their adoption by the Server-Side Java communities, those developers who use these framework and then out of their own good contribute quality enhancements and bug fixes to the various kits. For instance to support XML or Enterprise Java Beans. The best-supported kits will survive in a nutshell. It is, perhaps, too early to tell which one will become the winner or be in the winner's circle in a years time after the Java Servlets and JSP technologies have matured more. To paraphrase an old IT procurement statement: no one ever got fired for buying Java Server Pages. EvaluationAll of the "kits" are free as in open source. There is very little commercial support for all but one of them, which is not to say that any of these tools are bad. You cannot really compare these frameworks to proper close source development where there is funding and guaranteed chain of support as would expect if money changed hands. Most of open source projects have version numbers that rarely reach near 1.0. It is not unheard of that many a project will fall to the way side. Also many of the kits are apparently deliberately running against grade by being alternatives to Java Server Pages. It is difficult for small company to run against a giant like Sun Microsystems, so what chance does a small-time developer with a little framework have? What will decide these tools is their adoption by the Server-Side Java communities, those developers who use these framework and then out of their own good contribute quality enhancements and bug fixes to the various kits. For instance to support XML or Enterprise Java Beans. The best-supported kits will survive in a nutshell. It is, perhaps, too early to tell which one will become the winner or be in the winner's circle in a years time after the Java Servlets and JSP technologies have matured more. To paraphrase an old IT procurement statement: no one ever got fired for buying Java Server Pages. Gain ExperienceIt was decided to that we should get our toes wet.
We decided that WebMacro and Expresso looked to be best-of-breed of tools in term of features, popularity, and suitability. We intended to build on Java Server Pages with an application server. We decided to also check out the latest Apache Jakarta Tomcat Servlets and JSP container. The Location Web ApplicationI have written a sample web application that utilises Model/View/Controller
adapted to Java Server Pages and WebMacro Template Engine. There are available
online on the cedar machine. I concocted the simplest web application that
I think of, called Location. This application has a list of countries and
a list of cities. The single business rule of location is that a country
maps to the cities that are available in it. For instance if we have the
countries France and Spain, and the cities Barcelona, Paris, Granada, and
Grenoble, then Paris and Grenoble are members of France and the cities
Barcelona and Granada are associated with the country Spain. Comparison table JSP versus WebMacro
Closer look at Expresso FrameworkConclusionThe best solution seems apparently to be Expresso Framework because it is compatible to Java platform 2 Enterprise Edition, which is the direction that the company seems to be heading. It supports the Java Server Pages and the Sun recommendations of MODEL 2 architecture. Web Macro therefore looks disadvantaged because it does not support JSP of course, and has no built in support for J2EE. Although Web Macro can be extended to support Enterprise Java Beans and Server Side applications it would mean a solution that we have to carry as a passenger. In other words we would have to support these customisation and extension. On the other hand Expresso seems to have active list of developers and contributors who already acknowledging J2EE support and compatibility. This means we can leverage of them and conversely we can return the favour. Struts in more a web application toolkit and is not a web application framework. For example there is no database object persistence in Struts. The other web frameworks like Tapestry and Turbine could also be decent frameworks. However their sponsors seem to be too busy fighting the "big fight" and egos. They could be good or have considerable much better technology than Expresso, but their situation is marred when they stipulate they are indifferent to Sun's vision. Referenceshttp://ootips.org/mvc-pattern.html http://www.object-arts.com/EducationCentre/Overviews/MVC.htm \ This is another on-line paper about MVC with illustrations. http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc_p.html http://www.flashline.com/components/appservermatrix.jsp http://jakarta.apache.org/tomcat/index.html The End
|
|||||||||||||||||||||||||||||||||||||||
Last Modified: 24-April-2001