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'.
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.