Apache Wicket: Common mistake beginners make

Using Apache Wicket as the framework in your web application is a great decision in my opinion. If you are trying to build an application as a full stack developer Wicket will assist you in the frontend so you don’t have to write much JavaScript; maybe you will not have to write it at all. This way you can concentrate on HTML and CSS while all the dynamic parts can be created with the help of Wicket and for example components that are capable of using AJAX.

Component oriented framework

When I first started working with Wicket I was very focused on the Java code – the view layer and the HTML were always considered at the end of my workflow for a certain feature or web page that I wanted to build.

If this sounds familiar to you and you have tried to match the HTML the Java code and not the other way around I would suggest that you change your workflow like I did. It’s too easy to overthink everything when just working with your Java code and not focusing enough on the end result.

Think HTML first, then components

Instead of getting lost in all the Wicket components and all the code you can write to please the framework think about the end result first: How should the generated HTML code look like?

Write this HTML code first, have a look at it in your web browser, maybe tweak it until it really looks like it should and then start to insert Wicket code into the HTML and write the actual Java code.

It may seem obvious but since I’m not the only one who seems to have made this mistake when starting out with Wicket I thought I should share it. So think about HTML first and then make it work with Wicket.