This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSF and the fly likes create Richface Tree using JAXB API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "create Richface Tree using JAXB API" Watch "create Richface Tree using JAXB API" New topic
Author

create Richface Tree using JAXB API

Manoj Sahal
Greenhorn

Joined: Apr 27, 2012
Posts: 2
Hi,

I have to create richfaces tree. I am using JAXB api for reading xml & create java Object, now I am creating XmlNodeData object and filling it. when I view output on UI, tree is not generating..

TreeNode rootNode = new TreeNodeImpl();
XmlNodeData xmlNodeData = new XmlNodeData();
xmlNodeData.setName("manoj");
xmlNodeData.setNamespace("Sahal");
xmlNodeData.setAttribute("name", "Sahal");
xmlNodeData.setAttribute("action", "ACTIOn");


TreeNode node1 = new TreeNodeImpl();
node1.setData(xmlNodeData);
rootNode.addChild(new Integer(0), node1) ;


XmlNodeData xmlNodeDat1 = new XmlNodeData();
xmlNodeDat1.setName("manoj");
xmlNodeDat1.setNamespace("Sahal");
xmlNodeDat1.setAttribute("name", "Sahal");
xmlNodeDat1.setAttribute("action", "ACTIOn");

TreeNodeImpl child = new TreeNodeImpl();
child.setData(xmlNodeData);
rootNode.addChild(new Integer(1), child) ;

UI Code

<rich:tree id="treeXML" value="#{simpleTreeBean.treeNode}" var="vardata" style="width:300px" ajaxSubmitSelection="true" switchType="client" nodeSelectListener="#{simpleTreeBean.processSelection}" reRender="selectedNode" treeNodeVar="xnd" >

<rich:treeNode >
<hutputText value="#{vardata.attributes['name']}" ></hutputText>
<hutputText value="#{vardata.attributes['id']}" > </hutputText>
<hutputText value=" #{vardata.text}" />
</rich:treeNode>

If any one know .. Please help me..

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15632
    
  15

Welcome to the JavaRanch, Manoj!

It has been a while, but I believe that RichFaces has a way of dynamically generating tree nodes from POJOs without all that complicated JSF-specific code. I had a similar app where there was a 3-level menu 2-3 years back, and while I have forgotten the details, the basics are documented (although not as well as I'd like) in the RichFaces online documentation.


Customer surveys are for companies who didn't pay proper attention to begin with.
Manoj Sahal
Greenhorn

Joined: Apr 27, 2012
Posts: 2
Issue resolved thanks ..):
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: create Richface Tree using JAXB API
 
Similar Threads
Richfaces tree binding does not seem to work?
Richfaces Tree rich:treeNodesAdaptor not working
Richfaces Tree Does Not Display TreeNode
Rich:tree and managing expand/collapse from first load
JSTL choose tag not working for RichFaces Tree Component