Wicket is a Java Web Framework that uses POJOs and HTML to create applications. I read a lot’s of blogs that Wicket is so great, but never really bothered with taking it serious. When flying back from ApacheCon US, I read an article about Apache Wicket and I have to say, that I don’t buy the Wicket story, yet.
The key features of Wicket, as far as I got it, are:
A typical Wicket-HTML file looks like
<html>
...
<span wicket:id="value">Some value</span>
<a href="" wicket:id="link">Go there</a>
...
</html>
The Java file behind the page looks like this:
public class MyPage extends WebPage {
public MyPage() {
Label valueLabel=new Label("value" ...);
add(valueLabel);
Link link=new Link("link") {
@Override
public void onClick() {
setResponsePage(hardCodedLinkToAnotherPage);
}
};
add(link);
}
}
Noticed it ? Yes, it uses Java…., but that wasn’t the point. The structure of the HTML and the Java is same. You kind of rebuild the thing in Java, what your designer did before. Also the navigation is hardcoded
I am not sure if this all is really sufficient, when creating large applications, because it looks to me, that you are coding redundantly (HTML and Java).
In JSF you describe your view in a view-technology (Facelets, JSP, Clay,…) and behind you have a POJO object (managed bean) as well. It only captures the actual values. Sure you can code against the JSF-API, by using bindings. That allows you the creation of dynamic formulars, for instance.
What happens to Wicket, when I want to replace the Link class by an extension (FancyAjaxSomewhatLink for instance) ? Do I have to change all my classes ? In JSF the managed bean behind the page is somewhat independent from the “view-technology” as HTML, AJAX or even XUL, since it usually just captures the values. If you want to replace the default commandLink from the JSF standard API, by an extension, just change the declarative view, but you don’t have to touch the Java-code behind that page, like:
...
<ajax:myCoolCommandLink action="#{bean.theRegularActionMethod}" />
...
I like the fact, that there are different frameworks out there, but I belive in JavaServer Faces.
Perhaps it is worth to take a deeper look at Wicket, not sure on that, to be honest.