Adding a JavaScript script to the onLoad event using Wicket

After playing around with Wicket for a while and implementing a proof of concept I am now actually involved in my first Wicket project! A first time always comes with its typical problems, but with Wicket it certainly is not hair tearing. You can find a lot of good examples and faq’s on the net. 
However, I got stuck a while on how to get some javascript to be executed during the onLoad of a page. I could not find an out of the box answer to this. After struggling a bit, it boiled down to this:

add(new AbstractBehavior() { 
public void renderHead(IHeaderResponse response) { 
response.renderOnLoadJavascript("alert('it works!')"); 


How to run a demo Wicket application in two minutes

Inspired by the enthousiastic reports of other people I decided to have better look at Wicket, the upcoming MVC framework. 
Wicket is great for separation of code and gui. A web page is made out of a class and an html page, no need for jsp’s! For more information have a look at the site: 
I decided that the best way to get my first Wicket experience was to install the Maven archetype project. And well, after a few minutes I was looking at the first Wicket page that was served from within my own Eclipse IDE!

If you have Maven 2 and Eclipse installed, all you need to do is: 
1. go to the command line 
2. type: mvn archetype:generate 
3. choose the wicket archetype (at this time, it is nr. 36) 
4. fill in the options (choose ‘wicket’ as artefactid) 
5. change to the ‘wicket’ directory that now has been created 
6. create an eclipse project file by typing ‘mvn eclipse:eclipse’ 
7. start Eclipse 
8. import the Wicket project by selecting ‘import existing project’ and the ‘wicket’ directory as source 
9. run the ‘Start’ class as a Java app 
10. type in the url http://localhost:8080/wicket/ and there you go! 
The start class is not really part of the Wicket application, all it does is start an embedded Jetty server that runs the demo app.