You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by John Cavacas <jo...@sapiens.com> on 2003/05/02 21:59:11 UTC

Recursion with JSTL tags

Hi,

This may seem like a silly question, but I was wondering if there was a way
to achieve recursive behavior out of the core and xml tags.

I have this XML file which contains date in a tree format. Using the Core
and Xml tags, I use this XML file to build a navigation menu, where each
level is indented. Like:

Link 1
Link 2
 Link 21
  Link 211
 Link 22
Link 3

Etc.

Currently, I'm parsing the XML using the X tags, and I have to have a set
level of 3 levels, and a lot of duplicated code, in order to create such a
structure. This is begging for a recursive call, however I can't seem to
figure out how or if it is even possible using JSTL.

I've thought of maybe using include files, where there is one include file
which generates One level, and then it includes another JSP file, which
generates the second level, and includes itself to generate the third, and
so on levels. That's what I am currently experimenting with.

Does anyone have any ideas or suggestions? Again, sticking with JSTL use
only, I know this would be fairly easy to do other wise.

Many thanks,
John



This communication is intended for the use of the individual(s) or entity it
was addressed to and may contain confidential and/or privileged information.
If the reader of this transmission is not the intended recipient, you are
hereby notified that any review, dissemination, distribution or copying of
this communication is prohibited.  If you receive this communication in
error, please notify the sender immediately and delete this communication
from your system(s) to which it was sent and/or replicated to. (c) 2002
Sapiens Americas Corp.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Recursion with JSTL tags

Posted by Serge Knystautas <se...@lokitech.com>.
John Cavacas wrote:
> Hi,
> 
> This may seem like a silly question, but I was wondering if there was a way
> to achieve recursive behavior out of the core and xml tags.

JSTL prevents this in the sense that everything has to be an XML tag... 
there's no go to or self-referencing, so loops start and end.

I think you're on the right track with having a include of yourself.  I 
vaguely remember that according to comp sci theory you can write 
recursive logic without being recursive, but how you do that has long 
since left my brain.

-- 
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org