Results 1 to 4 of 4

Thread: Display tree on JSP, recursion?

Hybrid View

  1. #1

    Default Display tree on JSP, recursion?

    Hi there

    I have a "tree" structure of Node objects, each containing a List of children Node objects etc.

    I pass the root Node object to a JSP, and would like to display the tree structure.

    How do I display this on a JSP? For example, can I recurse with jstl or spring tags?

    Thanks for any help,
    Peter

  2. #2
    Join Date
    Aug 2004
    Location
    Amsterdam, Netherlands
    Posts
    450

    Default

    You could recurse using JSTL <c:forEach> tags. I suggest you have a look at JSP 2.0 tagfiles, I think they provide a flexible and easy to test wya to do what you want (recursively including JSPs, etcetera).

    Alef

    http://www.onjava.com/pub/a/onjava/2003/11/05/jsp.html

  3. #3
    Join Date
    Aug 2007
    Location
    Graz, Austria / St.Petersburg, Russia
    Posts
    5

    Default

    This JSP includes itself recursively:
    Code:
       1. ${node.title}  
       2. <div class="children">  
       3. <c:foreach var="node" items="${node.children}">  
       4.     <c:set var="node" value="${node}" scope="request"/>
       5.     <jsp:include page="node.jsp"/>
       6. </c:foreach>  
       7. </div>
    Here is a short explanation.
    Last edited by Ilya Boyandin; Nov 22nd, 2007 at 03:51 AM.

  4. #4
    Join Date
    Jul 2011
    Posts
    1

    Default probably you can try to use tree4jsp in your spring application.

    Google for tree4jsp. The tag looks easily integrable with spring applications, and also provides fairly good tree UI.

Similar Threads

  1. Database tree data and tree browsing
    By Bruno Thomas in forum Web
    Replies: 6
    Last Post: Jul 25th, 2005, 10:53 AM
  2. Replies: 1
    Last Post: Apr 28th, 2005, 01:54 PM
  3. Content Provider vs View Model
    By Martin Kersten in forum Swing
    Replies: 21
    Last Post: Mar 10th, 2005, 02:25 PM
  4. Replies: 0
    Last Post: Jan 22nd, 2005, 07:28 AM
  5. Replies: 2
    Last Post: Dec 18th, 2004, 10:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •