After lots of head-scratching and trying various combinations of jsp version and container, the results are this:
Trond's webapp works on:
+ Glassfish v2.1.1
It does not work on:
+ Tomcat 6.0.29
The original webapp attached to this issue works on:
+ Jetty-6/7 standalone, but only after a reload with the respective jetty plugins
(Glassfish and tomcat not re-tested).
The reason Trond's webapp and the original webapp work on Glassfish is that whilst Jetty-6/7 and Glassfish share a common codebase, at runtime Glassfish uses the JSR199JavaCompiler in-memory compilation class, whereas Jetty uses the JDTJavaCompiler class (which uses eclipse ecj to compile). There is obviously something about the in-memory compilation of JSR199JavaCompiler that works better with these types of recursive tags. Jetty-8 not only uses the same binaries as Glassfish, but also uses the same JSR199JavaCompiler class and hence works just fine with both webapps.
Interestingly, there must be also some difference introduced by the maven classloader that is used for the jetty-plugin that is interacting with the JDTJavaCompiler class. The original webapp throws the same kind of error as Trond's with the first hit, but on subsequent hits it works just fine. With jetty standalone, the first hit succeeds, but throws a FileNotFound warning for the .java source associated with the tag being compiled.
So, the short answer is if you have these kind of recursive tags, if doing a shift-reload is too annoying or not working for you, then use jetty-8 (plugin or standalone) instead, as that uses the JSR199JavaCompiler class that seems to work with recursive tags.