You can find the full Netbeans project here.
Essentially, the program logic is contained in only two files: ttt1.html, and CometServlet.java. Check ’em out. After my initial example two posts ago, these should be pretty self explanatory. If you have any questions, by all means ask in the comments below.
(This article was originally published on my java.net blog on May 8, 2008.)