Book Image

DWR Java AJAX Applications

By : Sami Salkosuo
Book Image

DWR Java AJAX Applications

By: Sami Salkosuo

Overview of this book

Table of Contents (12 chapters)

Implementing Field Completion


Nowadays, field completion is typical of many web pages. A typical use case is getting a stock quote, and field completion shows matching symbols as users type letters. Many Internet sites use this feature.

Our sample here is a simple license text finder. We enter the license name in the input text field, and we use DWR to show the license names that start with the typed text. A list of possible completions is shown below the input field. The following is a screenshot of the field completion in action:

Selected license content is shown in an iframe element from http://www.opensource.org.

Server Code for Field Completion

We will re-use some of the classes we developed in the last section. AppContent is used to load the sample page, and the DBUtils class is used in the LicenseDB class. The LicenseDB class is shown here:

package samples;
import java.util.List;
import java.util.Vector;
public class LicenseDB{
private DBUtils dbUtils=new DBUtils();
public LicenseDB...