Return-Path: Delivered-To: apmail-jakarta-taglibs-user-archive@apache.org Received: (qmail 58477 invoked from network); 14 Feb 2003 14:20:58 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 14 Feb 2003 14:20:58 -0000 Received: (qmail 23949 invoked by uid 97); 14 Feb 2003 14:22:29 -0000 Delivered-To: qmlist-jakarta-archive-taglibs-user@nagoya.betaversion.org Received: (qmail 23942 invoked from network); 14 Feb 2003 14:22:29 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 14 Feb 2003 14:22:29 -0000 Received: (qmail 52185 invoked by uid 500); 14 Feb 2003 14:19:13 -0000 Mailing-List: contact taglibs-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tag Libraries Users List" Reply-To: "Tag Libraries Users List" Delivered-To: mailing list taglibs-user@jakarta.apache.org Received: (qmail 52148 invoked from network); 14 Feb 2003 14:19:12 -0000 Received: from preter.essentially.net (65.219.63.27) by daedalus.apache.org with SMTP; 14 Feb 2003 14:19:12 -0000 Received: from precision (preter [127.0.0.1]) by preter.essentially.net (8.9.3/8.9.3) with ESMTP id JAA29915 for ; Fri, 14 Feb 2003 09:19:14 -0500 Date: Fri, 14 Feb 2003 09:19:11 -0500 (EST) From: Shawn Bayern X-Sender: bayern@precision To: Tag Libraries Users List Subject: Re: Looping a tree-structure of objects of unknown depth In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Fri, 14 Feb 2003, Sakke Wiik wrote: > I have a tree-structure of objects similar to a filesystem, where > directories has subdirectories to an unknown depth. How can i loop and > display all these in jsp without knowing the depth of the tree? it's > easy to do in pure java with a method calling itself, but I can't use > methods inside a jsp, or can I? You could define a method with a <%! ... %> declaration and use scriptlets; Java and JSP are really the same thing. But as a more interesting approach, you can think of each JSP page as a method or component; you can write a JSP page to handle each directory and then "call" it recursively with each time you encounter a directory. In other words, for a hypothetical "file" object with boolean properties like isFile() and isDirectory(), you could do the following: printDirectory.jsp ----------------------

Cute, huh? :-) -- Shawn Bayern "JSTL in Action" http://www.manning.com/bayern --------------------------------------------------------------------- To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: taglibs-user-help@jakarta.apache.org