Archive for category Wicket

Deploying Java Web Application on Jelastic

Tags: , , ,

Some time ago having your own full-fledged hosting with Java, Tomcat and any database wasn’t cheap, but luckily we live in a very interesting times and now there are many virtual hosting services in the Cloud providing an easy and affordable way to deploy your application and make it available to users.

And what is the best in such solutions, they grow with your application or startup. Services are free or almost free when your web application doesn’t need much memory and processors but when your web-app starts to gather more users’ attention and you have more and more concurrent sessions and visits each day, you could easily enhance your setup to match your needs. Everything is a matter of a few clicks, simple and fast.

To test how this deployment process look like, I’ve decided to put my Wicket tutorial web application online. It consist of three pages and two tables in database so I think it shouldn’t be a too complicated process to deploy it online. And as a Java hosting service I’ve chosen Jelastic, recent winner of 2012 Duke’s Choice Awards announced during JavaOne conference this year. Duke’s Choice Award is something like a Oscar in the Java world, so I thought that Jelastic might be a good choice to start with. Continue reading this post …


Be Sociable, Share!

Remember Me functionality in Apache Wicket

It is quite common in web applications to have “Remember Me” functionality that allows user to be automatically logged in each time when he visits our website.

Such feature can be implemented using Spring Security, but in my opinion using request based authentication framework with component based web framework is not the best idea. These two worlds just do not fit well together so I prefer to use my own baked solution which I will present below.

Base project

We start with a simple web application written using latest, still hot Apache Wicket 6. You can download complete sources from GitHub and start application using mvn clean compile jetty:run .

Base application consists of two pages:

  • Home Page: displays welcome message for logged and not-logged users or either logout or login link.
  • Login Page: allows user to login basing on simple in-memory collection of users. Some working login/password pairs: John/john, Lisa/lisa, Tom/tom .

Continue reading this post …


Be Sociable, Share!

Using Twitter Bootstrap Navbar as a Wicket component

Tags: , , , , ,

All of you probably heard about Twitter Bootstrap, an awesome set of components allowing to create nice looking web pages and application without diving deeply into CSS/JS hacks. If you want to see what this library is capable of, please visit http://builtwithbootstrap.com/ and check how people use it to build their websites.

But this post isn’t supposed to be about Bootstrap itself. In a few next paragraphs I will present how I created reusable Wicket component containing Bootstrap top navigation bar menu. And final result using Wicket in our example web-app will look this way:

Before styling applied:

After:Final Twitter Bootstrap Navigation Bar with Wicket


Be Sociable, Share!

Conversation scope in Wicket using CDI

Tags: , ,

Some time ago I was asked to do some research about integrating Wicket with conversation scope from Context and Dependency Injection (CDI) from JEE6 specification. And as not everything was clear and easy to run, I decided to post my findings in this blog.

Project setup

To make things easier we will base on existing example web application showing how to integrate Wicket with Weld (CDI) from project Seam-Wicket (formerly named weld-wicket). So first let’s pull latest version of Seam-Wicket project from Git:

git clone git://github.com/seam/wicket.git
cd wicket
mvn clean install

and in examples directory there is numberguess Maven project. Just import it into your favourite IDE and execute

mvn install jetty:run -P jetty

Continue reading this post …


Be Sociable, Share!

Wicket Tutorial, part 9 – storing and loading user preferences from cookies

Tags: ,

In the previous post we learnt a few tricks regarding internationalization features in Wicket. Today we will go further and will let application to remember some user preferences using HTTP Cookies. Storing some basic data in cookies is an easy and popular way of letting user customize look and feel of web application he uses very often. Some portals use cookies to render modules in order chosen by user so that most interesting information are in the top.

In our ItemDirectory web application we don’t have (yet!) any sophisticated mechanism which could rely on cookies so we will show how it can be used to store and load language selected by the user.

Continue reading this post …


Be Sociable, Share!

Wicket Tutorial, part 8 – adding internationalization support

Tags: , , , ,

Today we will continue Wicket tutorial series with adding support to multiple languages in web application. Ok, let’s do it step by step.

Create form to change language

To make our changes visible and testable at the beginning we add form to change application language. To make it more reusable we will implement it as a Wicket panel.
So first, let’s create html and Java files:

Continue reading this post …


Be Sociable, Share!