Archive for Coding: Apache Wicket

Override Wicket’s redirect to use “301 Moved Permanently” instead of “302 Found”

HTTP status codes 301 Moved Permanently and 302 Found are used to redirect a user’s web browser to a different location. A user will never notice the difference if your server sends a 301 or 302, but sending a 302 can have negative SEO implications, such as PageRank not transferring correctly to the target page. [...]

Check if a user already exists in a sign up form with a Wicket validator

A common use case during user sign up is to check if the user already exists, either by email address or by user name. Wicket makes this simple. The following example demonstrates how to verify that an email address isn’t already in use. It would be easy to write this to do a user name [...]

Adding a rel=canonical link in Wicket for duplicate content

Google recently introduced a new <link rel=”canonical”> tag to help the search engine identify duplicate content across domains or pages. I’m working on a development project that contains many subdomains under a single domain to present content specific to various geographical areas. Some of the administrative pages under each subdomain contain the same content (such [...]

You can embed wicket:message in any HTML tag for easy internationalization in Wicket

Here’s a useful Wicket i18n tip to reduce the amount of code you need to write. Any HTML tag in your HTML template can have a wicket:message attribute added to it. This is especially useful in <a> and <input> tags. For example, if you want a tooltip to appear when you hover the mouse over [...]

Configure WiQuery to not import JQuery automatically

I’ve been working on a Wicket project that requires JQuery to be present on every single page rendered by Wicket. I do this by including a reference to JQuery from my base page. However, when I add a wiquery component to a subclass of my base page, it automatically inserts a reference to JQuery as [...]

Apache Wicket: Group a set of CheckBox inputs using an enum

UPDATE: a few days after posting this, I realized that there is a CheckGroup wicket class that will group checkboxes together. I’ll write a new article to show how to integrate an enumerated checkbox group with the CheckGroup class. — When presenting a list of radio buttons to a user in a form, it’s a [...]