Has anyone ever tried to do JSP recursion via include?
We've got a situation where a jsp is recursing on itself to implement the equivalent of function recursion. The problem seems to be that either the variables being used in the jsp are not distinct from different levels of the recursion, or something else is being messed up. The reason we were trying to do the recursion is because the jsp is emiting tag lib for a recursive structure.

<% some java code %>
<tag:levelX>

<% some java code %>
<tag:levelX+1>

...

If we use functions, we find that they have to be in a declarative section which doesn't allow scriplets to work.

<%! public void func()
...
%> <== can't interrupt the func to place emitted tags

<tag:levelX>
<% more of the func
%>

The above doesn't work.
We tried using out.println, but unfortunately the tag library stuff is not evaluated when emitted via out.println.


Any ideas???? We'd like not to use jsp recursion, but haven't found a way that works.