Today: September 13, 2024 12:52 pm
A collection of Software and Cloud patterns with a focus on the Enterprise

Software licensing: Wicket pages and panels

My initial perception of wicket panels was that they were like includes. This naturally lends itself to header, footer and style content that will be the same throughout a web application and avoids duplicating code.

It seems wicket panels are more widely used than I first expected. For example, I keep seeing examples of a very lightweight page where panels represent the majority of the content too. This is a more segmented approach than I have seen in the past, and I can see some benefits and drawbacks to it.

Based on other frameworks I would typically structure each page with the following files:

  • header [common]
  • footer [common]
  • page

This would be repeated for additional pages with the header and footer representing the only elements common among all pages. In wicket the design changes by adding a new file

  • header [common]
  • footer [common]
  • page [common]
  • panel

By segmenting the content of the page out into panels, the page frame itself becomes reusable. It also makes it possible to use some clever wicket extensions, like breadcrumbs and tabbed ajax panels. These can save a lot of time in development. Another benefit is that it keeps you in the habit of creating panels for page sub-components, which can increase code reuse and maintainability.

The biggest pitfall I have found so far is that panels rely on state and the URLs are not bookmarkable. I know that’s what wicket is all about, but in terms of search engines and bookmarking pages, this can be a big drawback.

For example, when implementing the documentation pages for the API of the software licensing appication, I made use of the breadcrumb extension and put all the content in panels. I found afterward that based on the way it is implemented, it’s not possible to bookmark a link to a specific API document. The same lack of bookmarkable links exists in the tabbedpanel that I planned to use. Unfortunately this won’t do.

While I may leave the content as a panel, I now see that my implementation needs to be pages so that I can map them to specific URLs.

The alternative would be to make use of the extensions and give up the bookmarkable URLs. However, when I’m working with an API, emailing a support or user list or creating tutorials I frequently link to specific API documentation and I rely on Google to know how to find that documentation when I search for it.

I have sent an email to the wicket user list about the whether the breadcrumb extension can be made to work with bookmarkable URLs, but I didn’t get a response. If anyone responds then I’ll update this post with the solution.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.