- Posted by: Edmon Begoli
- Posted on: June 16 2004 16:27 EDT
I find myself struggling with dilemma which presentation framework to adopt as a long term solution for building of the presentation tier in J2EE technology. I would like to hear your opinions on which way would be the way to go in architecting the presentation tiers.
In my world I see 4 major architectural frameworks as candidates. I would like (and I suspect many of you would too) to find one framework that will help me build the presentation tiers.
I have identified Hibernate and Spring as close to ideal solutions for the remaining tiers (call them business and data if you wish), but I have real struggle with the presentation tier.
1. Struts 1.1 I mostly worked with plain Servlets/JSP and Struts. I was happy with Struts 1.1, particularly impressed with its power, but I was disheartened with its complexity, and clunkyness. It takes a good bit of work to do simple stuff.
2. JSF. I did not program much with JSF, but based on what I researched so far I did not feel very compelled to dive too deep into this technology. In many ways it looks like a JSR's attempt to standardize Struts like framework into the realm of J2EE. That is not a bad idea, but I am not sure if the solution is that beneficiary. In other words, should I drop Struts just for the sake of being under the J2EE API umbrella.
3. XML,CSS,XSL and XHTML. Initially I was negative about the XSL based solutions in J2EE, but ever since I worked with Novell NPS portal (presentation tier is all based on XML,CSS,XSL), and since I had pretty intensive exposure to CSS I am more open to adopt this technology. I still have my doubts about the maintainability and reusability of this kind of solution, but I also need more real life experience with this technology to judge it, adopt it or dismiss it too early.
4. Tapestry, Echo and other pure in-Java, OO frameworks. I did not work with these, but I did research them a bit. I like conceptual purity of the framework. I am concerned that Tapestry did not gain as much traction as Struts, and that Echo is not as open and independent as other Jakarta projects. (There is a full blown commercial version of it, there is one company that is behind it). I've also heard that Tapestry could be slower then Servlets/JSPs which is not good, since these are not speed demons anyway.
So my dilemma is: Let's say that I want to architect a multi tiered, no-hype, no-fluff, long lasting quality solution in J2EE technology. Let's say that I have already recognized Hibernate, Spring as the building blocks for other tiers. The question is now what should I use for the presentation framework?
I would like to hear some serious opinions on this
- TOE: Technology - Organization - Environment by Lofi Dewanto on June 17 2004 03:05 EDT
- Depends on your problem by Kris Thompson on June 17 2004 10:08 EDT
I always think about TOE (Technology, Organization and Environment) concept. Choose the products not only based on technology but also on:
- Organization: what people do you have in your company? Is standardization an important thing in your company? etc...
- Environment: do you have good developers with you? How fast do you need to get your solution up and running, or you can play a bit in advance? etc...
Based on those three components, you should be able to make the best decision for *this moment*. Remember that later on you will find, that many things will change...
Anyway if you want to know, why I use Enhydra and JOnAS please read the EJOSA documentation:
I also suggest you to look at MDA (AndroMDA included in EJOSA) before you begin, if you still have time.
Hope this helps,
Its not easy to ensure that the architecture will survive long-term however, here are some things to consider that can help you with some of the difficult decisions involved in your architecture.
A good architecture addresses the crosscutting needs of the application and the development team, such as scalability, reliability, maintainability, security, composition of skills, etc. The architect must also be careful not to use a bigger hammer than whats required to get the job done.
For non-trivial applications Struts is a good choice for many reasons. First, It is likely that you either have team-members with Struts experience or can hire people with this skill. Oh, and not to mention there are many websites, articles, and books on Struts, unlike many of the other poorly documented frameworks. Struts also integrates with the Struts-Validator framework making syntactic form validation much simpler.
To address your long-term solution concerns: I expect to see Struts evolve to meet future demands more quickly than some of the competing frameworks because if its market share.
You mentioned that Struts seemed to be complex and that it takes a fair bit of effort to do simple stuff. If you are only doing simple stuff Struts might be overkill.
For simpler sites consider:
I have also built a presentation tier effectively using XML / XSLT / Cocoon, with Castor for dynamic binding. This isolation between web developer and business logic developer was fantastic, but what the web developers found frustrating about this was the lack of WYSIWYG editing of the source content and lack of support for simple bits of dynamism. I really, really like the idea of pure XML presentation tiers with a transformation layer, but the team found the learning curve to be steep and the industry support to be immature.
Weve since migrated to Struts 1.1 with Tiles, and while I do agree that it takes a bit of extra work to do simple things, its reliable, fast, and it handles a lot of the problems that come up in more complex sites (like wizards, validation, double-submission of forms, internationalization, security). In short If the site is non-trivial I would use Struts 1.1 with Tiles.
PS: Its worth looking at iBATIS (http://www.ibatis.com/) for your persistence tier. Ive used Hibernate and iBATIS. I like both. In fact you can use iBATISs DAO layer with Hibernate.
Save yourself the frustration and poor hacks because if you HAVE to use Struts then use AppFuse because they have already done the hacks for you.
You really didn't go into enough detail to your problem to provide you with a black or white answer. Tapestry is great for component based web application and complete seperation of web designer and developer. Now if you were going to build an J2EE application tool (instead of a website with features) maybe you would like to consider a real bare bones yet extremely flexiable framework like Maverick. I personally would stay clear of JSF until it stablizes AND better tool support comes out because JSF is a tools based framework.
Personally for a one-solution-fits-all framework Webwork is the best but if you are really looking for a long-term solution to a specific problem than do look around and do make sure you understand your problem before trying to find a tool.