The example is a simple Web application that do simple Create, Retrieve, Update and Delete (CRUD) operation against a MySQL database.
Before starting writing you need to install the following on your system.
- Java 1.6 SE (http://java.sun.com/javase/downloads/index.jsp)
- MySQL Server and Query Browser (http://dev.mysql.com/downloads/)
- Maven2 (http://maven.apache.org/download.html)
- Eclipse EE 3.5.2 (http://eclipse.org/downloads/)
That's it! That took 3 minutes on a modest Internet connection. Are you still stuck on downloading the files on your Windows machine? And thereafter looking forward to reboot you system after each installation?
The Eclipse Ubuntu installation bundle is sadly quite old and therefore it is better to download the zip file manually and extracted it anywhere of you liking and run eclipse.exe (eclipse) in the eclipse folder.
Now lets create your database. Start the MySQL Query Browser and right click in the Schemata dockable window and then select Create Schema.... Enter simpledb.
Now double click on the newly created schema and then right click again to create a new table.
From here you can take several paths, either create a new project with maven archetype 'simple-webapp' (http://www.sonatype.com/books/mvnex-book/reference/web-sect-creating-project.html) or you can install the m2eclipse plugin (http://m2eclipse.sonatype.org/installing-m2eclipse.html) and create your project from Eclipse. Here, I will hopefully, choose the easiest way and do it manually, since we only will be needing two source files, where one will be empty – web.xml and index.jsp.
Now create you Maven Project Object Model file pom.xml in first-coffee/pom.xml
Now create your first-coffee/src/main/webapp/WEB-INF/web.xml
And finally your dynamic web page (first-coffee/src/main/webapp/index.jsp), where all your work be done.
To test your application, simply start the Maven built in web server, from your first-coffee directory.
Now open your web browser and enter the address http://localhost:8080/first-coffee/.
If you want to continue to further evolve this simple example, you can leave the jetty server running and simply refresh you web server, after saving your changes.