To work your way through this Sample
Application, a basic understanding of the fundamental concepts of
Servlets, Java Swing and JDBC are required. For more information please
referAdditional
References.
Technical Overview
Java servlets provide a new and exciting method of
developing server-side solutions. Servlets provide the features of
traditional CGI scripts with the added benefits of efficiency and
portability.
They are programs that run on a Web server, generally used
for generating dynamic web content. A servlet gets a request from a
client such as a web browser, processes the request, and returns the
response back to the client in the HTML format.
An applet is a java program that can be included
in an HTML page. The applet runs on the JVM inside the browser
providing rich UI capabilities on the browser. Applet communicates with
the servlet for processing client side requests. To know more about
Servlets/Applets refer the Additional
References section at the end.
This Sample explains, how to build a 3-tier
application that allows a Java applet to perform a two-way communication
with a servlet. The focus will be on the concepts and techniques
of applets communicating with servlets. The 3-Tier architecture is
shown in the following figure.
Application
Overview
The sample application is a 3-tier application,
where the applet on the client side interacts with the servlet which
then interacts with the database. The applet displays Employees
Organization chart using Swing's JTree components. At first, when the
applet is loaded, applet interacts with the servlet to load employee
details and construct employee organization tree. In turn, servlet
interacts with the database to fetch employee details for the applet.
Again, when the user selects particular employee from organization tree
in the applet, it sends request to the servlet to return job details.
The architecture used in this sample has
the following advantages.
1. Eliminates JDBC library dependency on the client.
If the applet directly interacts with the database, it has to load
database client libraries in every client. In the servlet-applet architecture, the database client libraries
are required only by the servlet.
2. Database is not exposed to the client.
The database is not exposed to the client and can reside inside the
firewall. The servlet is used indirectly to interact with the database.
Sample Application
Files
Readme file and Stylesheets
Directory
File
Description
ServletApplet/doc/
Readme.html
This file gives
introduction to the sample.
Install.html
This file has
instructions required to install and run the sample.