5. Not just Java - Dynamic HTML

Long gone (in Internet time) are the days when websites could be produced by the local sysop who scanned in some images from the company's brochure and knew a few HTML-tags. The possibilities for manipulating content and user interaction within the browser are expanding through something called "Dynamic HTML" (DHTML). As a Java programmer using servlets and JSPs, DHTML is something that should become part of your toolkit.

DHTML refers to a combination of HTML, Cascading Style Sheets (CSS), JavaScript and the browser's Document Object Model (DOM). Traditionally a page could only be altered by reloading a new page from the server. DHTML allows full control an HTML document within a browser after its page has been loaded. You probably have seen examples on the web such as "image roll-overs", pop-up content and collapsabe menus. DHTML is supported by most version 4 browsers, albeit with some differences in standards (see "Cross-browser DHTML" below).

From a programmer's point of view the entire document in the browser, i.e. its frames, images, paragraphs, tables etc., is represented as an hierarchical object model, the DOM (not to be confused with the XML DOM). Through JavaScript you can manipulate the elements of the DOM and thereby change the content/appearance of the document. Also, you can capture user events from these elements such as mouse moves and form submission, and subsequently process these to modify DOM elements. For example, a mouse moving over an image may produce a "mouse-over" event that is processed by changing the image by a highlighted version or popping up explanatory text. Document elements may even be animated by moving them around. This sounds great doesn't it ? We just need to get familiar with the DHTML standard and off we go ! Hmm, but who defines the DHTML standard ?

This hits an issue that has witheld many developers from embracing DHTML. First of all you need a version 4+ browser. The "official" standards body for DHTML-related specifications is the World Wide Web Consortium (W3). However the Microsoft and Netscape type 4+ browsers each have proprietary DHTML extensions that you must track as well.

Luckily the situation is much better now. Most users by now have type 4 browsers, plus some people (in particular the "Dannymen", Dan Steinman and Danny Goodman, see References section) have done good work on creating cross-browser DHTML libraries that you can reuse. As a Java programmer you may appreciate the fact that you can do reasonably clean object-based or even object-oriented programming in JavaScript. In my basic DHTML demos you will find some examples, but it is worthwhile to check out the DHTML resources. Once you have browser issues hidden behind a facade of cross-browser libraries DHTML programming becomes real fun.

So with Java gaining more market on the server and DHTML having these powerful features on the client, my idea with Pushlets was to directly couple these two great technologies in a very direct way. For this I have implemented a lightweight framework for the server and some DHTML libraries for the client. These are discussed next in the Design section.