Archive

Posts Tagged ‘wicket’

Sessions in Wicket

October 13th, 2008

Found out a valuable lesson about session management in Wicket today. Wicket tries to be as stateless as long as possible, I believe it takes some hints from how your pages are built to know if it needs to keep a Session around for longer than a Request.

So, if you find that newSession(Request request, Response response) is being called in your WebApplication class for each and every request (not somethng you want happening if you’re trying to keep state in the session between requests!) what you have to do is use the bind() method for the current session.

Using bind() can be done within the constructor of your custom Session class itself, or if you want more control over when Sessions persist, you can call bind selectively (i.e. only in the constructor of pages which use the Session to store/retrieve information intended to live between sessions).

e.g.

public class MyPage extends WebPage {
//...
   public MyPage(String id) {
      getSession().bind();
      //setup wicket components
   }
//...
}

General

Wicket in Action Review

September 9th, 2008

Wrote a review on the most excellent book Wicket in Action for the Mystic Coders.

For those who haven’t heard of Wicket, it’s a Java web framework that allows designers (the chaps good with Dreamweaver) to collaborate with the Developers (the guys good with Java) in such a way that neither destroys the others work. It’s quite a great framework I encourage you to give it a try, and of course read the book!

General