4. The Web Module

In common with most Enterprise Java applications GreenPages uses a web-based interface for user interactions. The following steps show how to create the controller for the application, implement that controller using a service from the OSGi Service Registry, and deploy both bundles to the dm Server instance.

It is assumed that the instructions in Chapter 2, Installation have been followed already and that the GreenPages zip file has been downloaded and unzipped as described in Chapter 3, Installing and exploring GreenPages. Rather than working with the fully completed application a skeleton version of the projects (found in $GREENPAGES_HOME/start) is used to demonstrate how to build the application in stages.

4.1 GreenPages set up

Before beginning development, configure the development environment to work with the application. In the case of GreenPages this means Maven and Eclipse.

Setting up Eclipse (STS)

A dm Server instance is created in STS that the GreenPages application will integrate with. Refer to Eclipse dm Server runtime and follow the instructions there.