Yes! My Jsp file looks exactly like the one provided into the "Example
Applications" (struts-2.0.9-apps.zip).
<script>
function treeNodeSelected(nodeId) {
dojo.io.bind({
url: "<s:url value='/tags/ui/ajax/dynamicTreeSelectAction.action'
/>?nodeId="+nodeId,
load: function(type, data, evt) {
var displayDiv = dojo.byId("displayId");
displayDiv.innerHTML = data;
},
mimeType: "text/html"
});
};
dojo.event.topic.subscribe("treeSelected", this, "treeNodeSelected");
</script>
<s:tree
theme="ajax"
rootNode="%{treeRootNode}"
childCollectionProperty="children"
nodeIdProperty="id"
nodeTitleProperty="name"
treeSelectedTopic="treeSelected">
</s:tree>
The tree works fine with the data provided in the example application but I
can't make it work with the data received from my Hibernate layer. So I just
want to know I should write the "ShowDynamicTreeAction.java".
Thank you!
Cosmin
----- Original Message ----
From: Dave Newton <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[email protected]>
Sent: Thursday, October 18, 2007 7:27:32 PM
Subject: Re: <s:tree> and Hibernate
--- Cosmin Stanciu <[EMAIL PROTECTED]> wrote:
> Action tab the funtionality is not shown. :(
Are you filling tree data via Ajax (which the example
on the wiki isn't)?
d.
---------------------------------------
Hi!
I have been trying for a week now to populate one <s:tree> with the data from a
database table but with no luck . I would really apreciate some guidance in how
to write the ShowDynamicTreeAction class that sends the date to the tree.
I'm using Hibernate DAO to receive the data from my database table and it looks
like this.
Category: id, name, parent_category_id (from a a recursive 1:n relation to the
same table using the id).
The Hibernate generated object (Category.java) has the fallowing fields:
private Integer id;
private Category category;
private String name;
private Set categories = new HashSet(0);
In the CategoryDAO class I have all the methods needed to retreive data from
the table:
- Category findById(int Id), List findById(int Id), List findParents() and I
can add any needed method...
My struts.xml has a reference to the class showDynamicTreeAction:
<action name="showDynamicTreeAction"
class="struts2.ShowDynamicTreeAction">
<result>/jsp/CategoryList.jsp</result>
</action>
I'm sure that helping solving this issue would be of much interest for all
those that intend to use s:tree in their application, as there no example or
help regarding this matter on the internet.
Thanks a lot!
Cosmin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com