aspose file tools*
The moose likes JSF and the fly likes Composite Recursive List Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Composite Recursive List" Watch "Composite Recursive List" New topic
Author

Composite Recursive List

Robe Eleckers
Greenhorn

Joined: Jul 08, 2009
Posts: 9
Hi, I'm trying to build a multi-layer list, preferably from a composite component. The eventual result should be something like this:

This should be generated dynamically based on a structure in a backing bean. What I found so far is that it cannot be done using the c:foreach tag (it gives a stackoverflow). So therefore I started writing my own FacesComponent by implementating of the UIComponentBase which handles the recursive writing of the <ul> and <li> tags. I created a facelet-taglib for this and this works as it should.

However, I would still prefer to implement this using the composite mechanisme. Any ideas on how to do this? I do know how to create a composite component, but I do not know how to handle the 'recursiveness'.

Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

Well, JSTL once again fails. No surprise.

I think your main constraint here is that you're thinking in HTML terms, not in JSF terms. There are other ways to render stuff like this than using <li> elements, especially for unordered lists. For example, using nested <div> elements. CSS provides a way to make divs look like listitems. Or, for that matter, like a lot of other things that used to require a discrete HTML element type.

However, that's still thinking in HTML terms, and I generally discourage use of raw HTML in JSF views. The closest JSF approximation to a div would be a single-column panelGrid.

I'm actually doing something like that for a quick-and-dirty app where I have headings that I can pop open via a mouse click.

But that's only one approach. It might actually make more sense to use one of the treeview or menu components that often come with extension tagsets.

Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Composite Recursive List