Reputation: 9935
I have to keep the user uploaded files under a directory by category. The application directory have to show this directory as tree on web page. I am using JSF 2.0 + Richfaces 4.0. I have to make programmatically to show directories structure with tree on web page. Any one provide the API or lib to get recursive directory structure from my root level directory?
Upvotes: 1
Views: 816
Reputation: 618
Use recursiveTreeNodesAdaptor & treeNodesAdaptor components
live demo : http://livedemo.exadel.com/richfaces-demo/richfaces/treeNodesAdaptor.jsf?c=recursiveTreeNodesAdaptor
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:form>
<rich:tree style="width:300px" switchType="ajax" stateAdvisor="#{treeDemoStateAdvisor}">
<rich:recursiveTreeNodesAdaptor roots="#{fileSystemBean.sourceRoots}" var="item" nodes="#{item.nodes}" />
</rich:tree>
</h:form>
</ui:composition>
Upvotes: 1