 | Level: Intermediate Michael Galpin (mike.sr@gmail.com), Developer, Adomo, Inc.
21 May 2007 In the
first part
of this tutorial series, you learned how to use the Google Web Toolkit (GWT) to
rapidly build an Asynchronous JavaScript + XML (Ajax)-enabled Web application and
deploy it to Apache Geronimo. In this installment, Part 2 of the two-part series,
you add more functionality to the application that you built in the first tutorial.
Take advantage of Geronimo to add new features to the application by managing access
to a back-end database. Then use GWT to add more dynamic functionality and easy
integration with the new features that the service provides. Also, take a look at
some of the dynamic HTML (DHTML) features of GWT and using native JavaScript within
a GWT application.
Objectives - Add more functionality to the application you built in
Part 1
by managing access to a back-end database.
- Use Apache Geronimo to add persistence to your Ajax-enabled Web
application.
- Set up a database to be used when your stock application is transformed
into a portfolio-management application that lets users get quotes on multiple
stocks.
- Create a database connection pool using Geronimo, make the pool available
to any application running on Geronimo, and add it to your portfolio application.
- Modify the service and the application to make use of the new features in
your service.
- Build a new WAR file using Ant, deploy it to Geronimo, and test
it.
Prerequisites
This tutorial is about building a Java Web application, but you only need to
understand the basics of Java servlets. GWT leverages many ideas common to other
technologies, such as layout management, event systems, and remote procedural
calls (RPCs), so prior exposure to these ideas makes it easy to master GWT. The
tutorial uses SQL and Java Database Connectivity to work with a relational
database, so some familiarity with these tools is helpful.
System requirements
You need the following software to set up your development environment
before getting started:
- Geronimo 2.0 with Tomcat — The sample Web application in this tutorial
was built using Geronimo with Tomcat, but it should also work with Geronimo with
Jetty, because everything is standard Java Platform, Enterprise Edition (Java
EE). This tutorial uses Geronimo 2.0 (M3) but should work with older versions of
Geronimo as well.
- Java 5 or Java 6 — The sample Web application uses generics and
annotations. It was developed using Java 6, but also tested against Java 5.
- Apache Jakarta implementation of JSTL 1.1 — Geronimo 1.1 is a
certified J2EE 1.4 implementation, so you need to use JSTL 1.1.
- Google Web Toolkit — This tutorial is all about the GWT; download GWT
1.3.3 for this tutorial.
- Eclipse — The sample Web application is built using Eclipse, as you'll
see from the screen captures. GWT includes a convenient command-line tool for
creating a skeleton Eclipse project. It's not hard to build GWT applications
without Eclipse, but Eclipse provides a great debugger to debug your GWT
application.
- MySQL 5.0 — The sample application uses MySQL as its database. One of
the great things about Enterprise Java and Geronimo is that you can easily
switch out and use a different database. A great alternative is Apache Derby,
which comes embedded in Geronimo. There were some bugs with Geronimo using
embedded Derby as part of the 2.0 development, so this tutorial uses an external
database.
For instructions on downloading and installing GWT, see
Part 1
of this series. To view the demos included in this tutorial, JavaScript must be enabled in your browser and Macromedia Flash Player 6 or higher must be installed. You can download the latest Flash Player at http://www.macromedia.com/go/getflashplayer/.
Duration
Under 2 hours
Formats html, pdf
|  | |  |