0

I need select a folder and list its files.

But I can't give the user, access to the fileSystem, so I need to list the subfolders from a specific path (/u01/SNV).

I'm trying to use a <p:tree> for that. But I can't seem to manage populating the tree. (I've been looking on Google for a couple of days now)

That's the code I have for the tree:

<p:commandButton value="Load"
                 action="#{treeBasicView.LoadTreeBean}" 
                 update="TreeBean"
                 immediate="true"/>     


<p:tree value="#{treeBasicView.root}" id="TreeBean" var="node" dynamic="true">
    <p:treeNode>
        <h:outputText value="#{node}"/>
    </p:treeNode>
</p:tree>

[UPDATED] I need is the routine to look in the Hard Drive for the folders and create the nodes based on those folders. I don't have specific folders. I need to read them dynamically.[/UPDATED]

Thank you all in advance.

1 Answers1

1

Take a look to primefaces showcase. This seems that you want: http://www.primefaces.org/showcase/ui/data/tree/icon.xhtml

The part about manage populating is delegated to DocumentService.java.

Of course, you can also manipulated data model after render phase.

giaffa86
  • 708
  • 1
  • 9
  • 22
  • Thanks for the input. But what I need is the routine to look in the Hard Drive for the folders and create the nodes based on those folders. I don't have specific folders. I need to read them dynamically. thank you very much. – Carlos Junior Dec 18 '14 at 11:12
  • You need something [like that](http://stackoverflow.com/questions/1844688/read-all-files-in-a-folder). Starting from there, try yourself to implement JSF code and create your TreeNode root. – giaffa86 Dec 18 '14 at 11:34