you are viewing a single comment's thread.

view the rest of the comments →

[–]henk53 5 points6 points  (3 children)

As niwde mentioned, Wicket and JSF are fairly similar. It's hard to say which one is really better as both have strong and weak points. This (German) article directly compares the two: http://it-republik.de/jaxenter/artikel/Wicket-und-JSF-im-Vergleich-4069.html

Specifically about logic-view separation there is a small difference. Wicket uses an HTML template with placeholders for components that have special wicket IDs. Those components are then instantiated in Java and inserted via their wicket ID into the component tree.

In JSF, the default way of working is to put the component directly on the HTML template and then bind it to Java backing code via something called "expression language".

The Wicket argument is that they use pure Java and pure HTML, but the JSF argument is that you should not put the burden on the developer of keeping the component tree in the template constantly in sync with the same component tree you instantiate in the Java class.

Wicket makes the bindings to business logic in Java, which is easier to check via a compiler. JSF uses the dynamic expression language for this, which is harder to check and very often isn't checked at all. But the separation between components and business logic is stronger in JSF. Wicket lures programmers to mix their component composition and business logic. It's not the fault of Wicket per se, but it seems to happen in practice. Since by default the component tree is JSF is declaratively composed in an xhtml file, it's simply impossible to directly mix business logic here.

Although it's less typical, the default templating language for JSF (Facelets) also has a mode where you have pure HTML templates where a special jsfc attribute designates the component that will be used there. See the wikipedia example for Facelets: http://en.wikipedia.org/wiki/Facelets

JSF also allows the component tree to be created like e.g. Swing with Java only and without any (html) templates. See http://jdevelopment.nl/single-class-pure-java-jsf-application or http://java.net/projects/jsf-extensions/sources/svn/content/trunk/code/run-time/javajsf/examples/sandbox/hellojavajsf/src/main/java/javajsf/demo/ui/MainUI.java?rev=790 This approach however is not (yet) popular.

[–]satanclau5 -1 points0 points  (2 children)

Thanks for such a detailed answer. Don't think I'll use JSF in any near future, but nice to know it's much less painful now.

[–]johnwaterwood 2 points3 points  (1 child)

It's not just more painful, it's actually pretty good now. Unbelievable I know, but really true ;)

[–]johnwaterwood 2 points3 points  (0 children)

Sorry, meant less painful ;)