Db-access-in-gwt-the-missing-tutorial

Disponível somente no TrabalhosFeitos
  • Páginas : 19 (4513 palavras )
  • Download(s) : 0
  • Publicado : 3 de junho de 2012
Ler documento completo
Amostra do texto
DB Access in GWT Tutorial 1

Database Access in GWT – The Missing Tutorial
A programmer's guide on integrating MySQL into Google Web Toolkit Applications
using the Eclipse Programming Environment

Bastian Tenbergen
bastian@tenbergen.org
http://www.tenbergen.org

Human-Computer Interaction MA Program
Department of Psychology
Department of Computer Science
State University of New York,College at Oswego
Oswego, NY, USA

DB Access in GWT Tutorial 2
1. Abstract.
This tutorial explains the principle method of adding MySQL support to dynamic GWT Web
Applications using asynchronous callback with Remote Procedure Call providers. Even though there
are already plenty information on this topic available on the Internet, a detailed, step-by-step
explanation seems to be missingso far. The mission of this tutorial is to provide such an explanation in
a more detailed fashion than the GWT Examples [3] provide.

2. Table of Content.
1. Abstract

2

2. Table of Content.

2

3. Preamble.

3

4. Introduction

3

5. Assumptions

3

6. The Missing Tutorial

4

6.1 The Short Version

4

6.2 Necessary Software

5

6.3 Add MySQL to Java

56.4 Add MySQL configuration to GWT.

6

6.5. Clean your project.

7

6.6. Make the client side be aware of the Servlet.

7

6.7. Create serializable objects for callbacks.

8

6.8 Create the Servlet.

10

6.9. Prepare an RPC Provider in your GWT App.

12

6.10. Make Remote Procedure Calls from your GWT application.

13

7. Summary

16

8. Acknowledgements.

16

9.References

17

DB Access in GWT Tutorial 3
3. Preamble.
This tutorial is my attempt to summarize my findings in search the Internet on how to do so,
along with massive findings that I discovered myself in “taming” the beast of GWT and MySQL. I
neither claim this document to be correct, nor flawlessly correct. If you notice any glitches, please
contact me for revisions.
This documentmay be used, (re-)distributed, shared and made available in printed or electronic
version for personal, educational, and scientific use without explicit permission. You may not gain any
financial profit or any other profit from my work without explicit prior written permission. Prerequisite
for any distribution and use of this document is that used in it's entirety, with copyright noticesintact.

4. Introduction.
Why this tutorial? Isn't there enough info on this on the Intertubes? Well, yes. And no. There are
a few good sources, especially the ones from the makers [3], but none really explains the special
nuances, like that the DB driver has to live in a Servlet. In fact, that is the most important take-home
message: The actual database queries are handled by a Servlet and youneed to make RPC calls, using
a callback handler to have the client side GUI (recall that the GWT application is executed client side
in the browser, not on the server!) talk to the database. The mission of this tutorial is hence to show the
necessary steps needed to integrate MySQL with GWT applications and explain what happens at each
step.

5. Assumptions.
I will assume that you have anunderstanding of how to do GWT in first place. At least you
should know that GWT is a Java front-end for dynamic JavaScript/AJAX Web Applications, that you
the main class implements the EntryPoint interface and all the other stuff to get a very basic GWT App
working in your browser. I will also assume that you know basic Java, like classpaths, dependencies
and such. I also will assume that youhave some dynamic web server, like Tomcat, at your disposal, and
that you can use the world's largest knowledge base [4] to find out how to configure it.

DB Access in GWT Tutorial 4
6. The Missing Tutorial.
In this little tutorial, we will implement a simple thing – a LoginScreen that will allow you to
enter a user name and a password, and authenticate this combination. Assuming, of...
tracking img