Getting Started


Web Application Overview

The image below depicts your typical web application scenario. Viewing the image from left to right, the DataTables interface represents the client side which is how you would view DataTables in your browser. Following that is the cloud representing the Internet. Next is the physical server that houses your web application files. The server, in turn, is bound to a database containing all the data you wish to manipulate.

Workflow diagram of a web application

MVC - Model, View, Controller

MVC is a software architectural pattern for implementing user interfaces. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user. DataTables and Editor both make up the View portion of this pattern. JED (Java Editor for DataTables) makes up the Model portion of this development pattern. Therefore, two components are already created for you. All that's left is for you to create the Controller portion of the pattern. As a starting point, this website contains numerous examples which you can refer to. Each example provides a tab control with a tab labelled "Java". This tab displays the source code for the controlling JSP file for the given example. In a production environment you would likely prefer to use a Servlet as your controller since it is already compiled into byte code.

JED can run on either a Microsoft operating system or Unix/Linux based operating system inside a Servlet container such as Websphere, Glassfish, or Tomcat.

To create your Java Web Application, you will need an IDE (Integrated Development Environment) such as Eclipse or NetBeans plus a Servlet Container. There are several Servlet Containers that are available, however, for the sake of this tutorial we will be concentrating on one product in particular named Tomcat. Tomcat is freely available and can be obtained here: . It is always a good idea to choose the latest version when you download it. This tutorial will make some assumptions in that you are a developer and have worked with Tomcat or some other Servlet Container previously. If you are new to working with Servlet Containers, it is strongly recommended you read the documentation pertaining to the product to familiarize yourself with its setup and how you load a web application within it. This tutorial is regarded as a "fast-track" guide only and does not attempt to duplicate the extensive documentation regarding Tomcat, or any other Servlet Container.

You will need to reference JED-1.#.jar and its dependencies in Eclipse/Netbeans to ensure it is on your classpath.

JED handles three processes on the server side:

  1. Using an instance of the Parameters class, you read in and collect all the parameters being sent to the server side from DataTables.
  2. Using an instance of the Editor class, and possibly from any number of Join classes, you define the tables and fields in the database that will be affected in any given transaction. The Editor class contains all the business logic that determines what type of action to take; to perform a SELECT query, or an INSERT, UPDATE, or DELETE. The parameters collected in the first process are used to help Editor to execute the proper action on the database.
  3. The Database class performs the actual query and returns a result to the instance of the Editor class. The Editor class then has a method you can call named toJSONString(), which will translate the results of the query to a JSON string. That JSON string is then sent back to the client side to DataTables to display the data appropriately.

NEXT...