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.