views:

204

answers:

2

I come from a .NET background and need to do a web project in Java. I have read a bit on all the different Java web frameworks out there: JSF, Stripes, Wicket, Tapestry etc.

But I would like to hear from people with real-life expertise with these frameworks.

Of course I want a framework that is up to date, supports AJAX, is cool and so on, but one of my main criteria is the ability to somehow create reusable components / tags. The customer needs to be able to move tags/components around without too much problem in order to customize it for their specific needs.

In ASP.NET Webforms I would use custom controls and user controls for this, and in ASP.NET MVC I would use user controls as well as home made custom controls. So what Java frameworks excel in this?

My own superficial research seems to conclude that JSF supports some kind of custom controls (Bear in mind i am not only talking about layout reuse, but also behavior reuse, so if for example the customer / client wants a customer list on page x and not only on page Y, he would simply put in a <jr:CustomerList runat="server" .... /> (fictional example with ASP.NET Webforms syntax)).

+1  A: 

I think most Java web frameworks let you reuse components and/or tags. They differ in flexibility, control, the availability of standard components and features like search engine friendly URL’s.

There are basically two categories of frameworks: component based (JSF, Wicket, Tapestry, GWT) and action based (Struts, Stripes, Webworks, Spring). Both allow you to reuse components, but the component based frameworks hide the low-level http stuff and let you use state full server components.

What type is the best depends on what you needs. Do you need maximum control over you’re HTML, high performance, search engine friendly URL’s then I would prefer an action based framework. If you prefer to hide the http side and want to program more high level as if you’re building a windows application, then I think you’re better off with an component based framework.

JSF: a complex framework, most programmers think it’s not very elegant. But as it’s part of the Java EE standard it’s a defacto standard.

Wicket: just like JSF a component-based framework. But it’s much more straightforward and elegant (You might also want to consider Click).

Tapestry: also a component framework, it’s seems especially strong in it’s library of standard components for building powerful web applications.

Stripes: my personal favorite, it’s a simple, very elegant and an easy to learn MVC framework. As it’s not a component based, but an action based framework, it offers maximum flexibility. It gives you full control over the generated HTML (as most component based frameworks can’t). It let you reuse components, by reusing templates used by the Java controller. End user can simply customize the HTML templates or use you’re custom tags. I choose this framework as it supports search engine friendly link generation.

Kdeveloper
JSF 2.0 is better...
Thorbjørn Ravn Andersen
Thanks - I think I will try out Tapestry :)
Jacob
JSF offers integration with rich faces and you get a lot of ready made utilities
vsingh
A: 

I recommend Tapestry.

Examples at Jumpstart (see "Creating Components"). If you can't get to port 8080, the home page is here.

Tapestry components and pages are made up of an XHTML file and a Java source file (like CustomerList.java and CustomerList.tml). The component is self-contained, and can do just about anything a page can do. Then you add your component to your pages' HTML like this: <t:CustomerList />.

You can also define your own arguments, like

<t:CustomerList myCustomers="accountsPayable" ... />.

In my opinion this is a more elegant solution than JSF, and I think Tapestry's IoC container makes it more powerful than Wicket. We are using Tapestry for an intranet with a few thousand users.

Nick
Before using Tapestry, you must read this: http://stackoverflow.com/questions/1303438/why-did-you-stop-using-tapestry/1310032#1310032
Pascal Thivent
Yeah, my own further research also seemed to suggest Tapestry. Seems very nice. A bit worried about the apparent major changes between releases tho'!
Jacob
That's a valid concern, but the developers received such a backlash for breaking backwards-compatibility between versions, I think they've learned their lesson. Tapestry 5 was released sometime around November 2008 and the API hasn't significantly changed since.
Nick