Sunday, February 5, 2012

Integrating Wicket with Spring

In this short example I will show you how to integrate Wicket 1.5 with Spring 3. Wicket is a rich web framework that allows creating web applications using simple html and Java code. Wicket has its own IOC/DI engine, but Spring has become a de-facto standard for service layer.

Tuesday, January 31, 2012

My Wicket improvement for StringValue was supported!

Working with Wicket I was sadly surprised by the behaviour of StringValue class. I needed to get optional parameters from URL, such as page number or document id. This parameters may have values, but can be omited and should be replaced by default value.

So I used this code to get page number, default page is 1.

PageParameters parameters = ...
int currentPage = parameters.get("page").toInt(1);  // default value is 1


Unfortunatelly, toInt(1) throwed StringValueConversionException instead of returning 1.


Wednesday, January 25, 2012

Suggest using JQuery Autocomplete and Wicket

You know that cool Google feature called Suggest? When you type into search input box, it offers you some possible search queries. JQuery has a plugin for this, it is called JQuery Autocomplete. In this article I will show you how to make Suggest feature using JQuery and Wicket.

Tuesday, January 24, 2012

Resizing Images in Java. Creating thumbnails

In this article we will find out how to create thumbnails from images with Java. Thumbnails are used everywhere on web e.g. eshop product catalogue, image galleries etc.  So what does Java offer to a developer?  We can use standard Java libraries or imgscalr library for this.

External Image in Wicket

This component allows creating an image that is loaded from external URL. All we need is to instantiate a new ExternalImage component by passing image URL to constructor and add it on a page.

Using Wicket Panel to create Reusable Component (Widget)

Why do we like components? They save our time. Once developed, they can be used many times. In this article we will create reusable component using Wicket Panel.

How to calculate the number of pages for search results

Imagine we have some records in our database, and we want to show them separately, divided in pages. Under the list we want to show hyperlinks to the next and previous pages. In the previous artice Long list pagination in Java I explained how to make Pagination. But for the pagination to work we need to know total number of rows. There are several techniques that are suitable in different situations.