aspose file tools*
The moose likes Struts and the fly likes Problem in giving action on tree created using <s:tree> tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem in giving action on tree created using <s:tree> tag" Watch "Problem in giving action on tree created using <s:tree> tag" New topic
Author

Problem in giving action on tree created using <s:tree> tag

sunny choudhary
Greenhorn

Joined: Mar 04, 2009
Posts: 6
Hi,

I am facing problem in giving action when I click on any node of the tree.
This tree is created using Struts2 <s:tree> and <s:treenode> tags.
Any pointers regarding this will be helpful.


Best Regards,
Sunny
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

http://faq.javaranch.com/java/ItDoesntWorkIsUseless
http://faq.javaranch.com/java/TellTheDetails
sunny choudhary
Greenhorn

Joined: Mar 04, 2009
Posts: 6
Hello,

Sorry for not providing the problem in detail.

I am creating a tree structure using the Struts2 tags <s:tree> and <s:treenode>.
I have written the following code for the same -

<s:tree theme="ajax" id="monitorTree" label="CCMS Monitors" >
<c:forEach var="monitor" items="${sessionScope.monitorNamesList }">
<s:treenode theme="ajax" label="${monitor }"></s:treenode>
</c:forEach>
</s:tree>

monitorNamesList is the list of monitor names that i have to display as tree nodes.
The tree is created successfully but my requirement id to give an action if I click on any node of the tree.

I am not finding the solution on how to invoke an action on click of any tree node.
Any help regarding this will be appreciated.


Thanks and Regards,
Sunny
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Have you read the tag docs for the tree tags? I think tree takes a "selectedNotifyTopics" (or something like that, I don't remember) that specifies the topic to be published on node selection.

Note that the wiki docs for S2.0.x tags are found in the S2.0.11 docs--anything above that is for S2.1. Note also that the Dojo-based tags are deprecated as of S2.1.6 because of the ancient version of Dojo they use.
sunny choudhary
Greenhorn

Joined: Mar 04, 2009
Posts: 6
Hi,

Thanks for replying.

Tree takes one parameter treeSelectedTopic. Is this the parameter that you were talking about.
The details about this parameter is not given. Also I am not able to find any example on it.

If you can provide some exapmle on it or how to use this parameter then it would be very helpful.
I am new to Struts and I am finding difficulty in doing so.


Regards,
Sunny
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Maybe there's an example in showcase; I don't recall. In any case, there are other examples for Dojo's topics for other tags--I'd assume this one works the same way.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in giving action on tree created using <s:tree> tag