Thursday, February 1, 2007

AJAX and tapestry

I've been using the new asynchronous features of tapestry ever since 4.1 came out. They are super handy, as they replace the disparate libraries, tapestry-based and otherwise, that were used with 4.0 and before.

I have, however, run into a problem I haven't been able to solve yet. It bugged me so badly that I created an entire project and even this weblog to post about it. It seemed like a good idea to start a weblog, and why not? Here I can document all the solutions to all the nitpicky little things I come across on a daily basis. So this can be the first!

Here's some background on the subject.

If you want to try out this sample app, which demonstrates the problem, you can download the source. You can create an IJ Idea project for it just by typing 'mvn idea:idea' on the CLI (or presumably 'mvn eclipse:eclipse' for an Eclipse project). Assuming you have maven installed, of course.

You can build a war file just by typing 'mvn package' on the CLI, or if you really want, just download the war file (no source there though).

Lastly, you can try my little demo too. It just has an AJAX-enabled link, which when you click it brings up a list of links. Each of these links in the list should pop open a window, but they don't. If you use something like tcpflow to see traffic over port 8080, you can see the ajax response. In this situation it is divided into two parts - the div to be updated, and the javascript to be updated. The former occurs, but the latter doesn't. I want to know why! And what to do to fix it.

Thanks for listening!

Update: This is now fixed in the latest 4.1.2-SNAPSHOT!