Wicket mounting in an OSGi environment

This page describes how to do page mounting in Wicket in an OSGi environment. A resource/page/etc. can be registered to Wicket’s WebApplication via a couple of ‘mount’ methods. This example only shows how to mount a page (to keep it simple) but can be extended for IRequestMapper/resource/package as well.

Continue reading Wicket mounting in an OSGi environment

Wicket and CKEditor in Internet Explorer

CKEditor was working properly in Internet Explorer while developing our Wicket application. After deployment to our demo server it wasn’t working anymore. We had no issues with FireFox/Chrome or Safari. First we thought it had to do with some timing issues but after a lot of debugging we found out the issue (and of course the solution ūüėČ ).

Continue reading Wicket and CKEditor in Internet Explorer

How to check whether Javascript is enabled in Wicket

It is possible, via Wicket, to gather a lot of information regarding the browser/system of your visitor. If you want this you can also turn on some extended information (like javascript is enabled) via the following code:

getRequestCycleSettings().setGatherExtendedBrowserInfo(true);

This method works via a redirect to the BrowserInfoPage and finally it goes to your ‘original’ page. Because of this it is possible that you see the BrowserInfoPage very shortly especially on slow computers/browsers or internet connections. But what if you don’t want this and only want to know whether Javascript is enabled? Please read on…

Continue reading How to check whether Javascript is enabled in Wicket

AjaxTabbedPanel – Store state when switching tabs

Normally when you switch tabs of an AjaxTabbedPanel it won’t store the state of all your input fields. If you do want this, without pressing a save button, you have to override the newLink(String linkId, final int index) method of the AjaxTabbedPanel class and use an AjaxSubmitLink instead of the default AjaxFallbackLink. Now all values will be stored in the model (not saved to the database).

Keep in mind that all Wicket validations will be validated, so we have to take care of the FeedbackPanel (refreshing) as well.

Continue reading AjaxTabbedPanel – Store state when switching tabs

AjaxTabbedPanel in combination with AjaxLazyLoadPanel

Wicket (extensions) offers a AjaxTabbedPanel to take care of your tabs. The constructor of the AjaxTabbedPanel expects a wicket id (obviously) and a list of ITabs. The implementation of this interface should return the panel via getPanel(String panelId) which will be the ‘actual’ tab. Out-of-the-box Wicket (extensions) offers an abstract implementation of this interface (AbstractTab).

What I want to achieve is that an AjaxIndicator (loading image) will be shown on the place were the actual panel will come till it is completely loaded. Especially when you have a lot of components to render this can be handy. See image below.

Example

Example

Continue reading AjaxTabbedPanel in combination with AjaxLazyLoadPanel

Wicket’s RequestLogger

Wicket provides you with a build-in request logger. It can give you a lot of information. See also example below. To activate this logger you have to enable the logger and setup (in our case) some Log4j configuration. In this post I’ll show you how to get this done.

Continue reading Wicket’s RequestLogger

Wicket’s FormComponent setType

If you are creating a form for your application you might need some validation on components before submitting. Wicket has some methods (e.g setRequired(true)) which can help you with that. In this article I will show you the setType method. This method will prevent you to submit the form when e.g. the input field is not filled in correctly. An example could be when your users have to fill in a double as number. If the user fills in something else it will show a warning in the feedbackpanel. See java example below how to deal with this.

Continue reading Wicket’s FormComponent setType

Wicket Debug / Deployment mode

By default, Wicket starts in development mode. When you want to deploy the application to your live system you will have to switch to deployment mode. This blog describes 3 ways to achieve this.  

  1. JVM Argument
  2. Servlet/filter initialization parameter
  3. Context initialization paramater.

Continue reading Wicket Debug / Deployment mode

Create a Wicket project by using an Archetype

This article describes step-by-step how to setup a Wicket Quickstart project¬†by using¬†Maven2 Archetype. After¬†finishing all steps you’ll be able to run the¬†Quickstart project in your favourite webbrowser.¬†I assume that you already have a Java Development Kit (JDK)¬†installed.¬†Now lets get started.

Continue reading Create a Wicket project by using an Archetype