Hi All,
Write some html page to call action for tree - home.html
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
html
head
META HTTP-EQUIV=Refresh CONTENT=0;URL=treesupport.action
/head
body
h3One moment please./h3
/body
/html
Include Struts and Extended dojo tag libraries in your web-inf/lib folder
Below is the JSP page that will execute upon success of
treesupport.action, Named that as tree2.jsp
%@ taglib prefix=sx uri=/struts-dojo-tags %
html
head
titleTree/title
sx:head parseContent=false/
script type=text/javascript src=../dojo/dojo/dojo.js
djConfig=isDebug: false, parseOnLoad: true/script
script type=text/javascript
dojo.event.topic.subscribe(nodeSelected, function(source) {
var selectedNode = source.node;
alert(You selected node + selectedNode.title);
});
/script
/head
body
sx:tree rootNode=rootNode
childCollectionProperty=children
nodeTitleProperty=title
nodeIdProperty=id
selectedNotifyTopics=nodeSelected
/sx:tree
/body
/html
In Struts.xm, call the treesupport action on success return tree2.jsp
?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE struts PUBLIC
-//Apache Software Foundation//DTD Struts Configuration 2.0//EN
http://struts.apache.org/dtds/struts-2.0.dtd;
struts
constant name=struts.enable.DynamicMethodInvocation value=false
/
constant name=struts.devMode value=false /
package name=default namespace=/ extends=struts-default
action name=treesupport
class=org.kp.sample.TreeSupport
result/paytools2/tree2.jsp/result
/action
/package
!-- Add packages here --
/struts
Write a Class with TreeSupport.java and Node.java - In Node.java. include
your business logic what values you want to populate in the tree. To make
this work, you have to create a project as Web2.0 and add struts2 and
dojo-tags to the library as well as dojo tool kit.
Hope this solves in creating a dynamic tree.
Thanks Regards
Bala T Ramanadham
NOTICE TO RECIPIENT: If you are not the intended recipient of this
e-mail, you are prohibited from sharing, copying, or otherwise using or
disclosing its contents. If you have received this e-mail in error,
please notify the sender immediately by reply e-mail and permanently
delete this e-mail and any attachments without reading, forwarding or
saving them. Thank you.
Thanks Regards
Bala T Ramanadham
MyHR - TIME
Parsons West Annex, 7th Floor
Office: 626-381-2434
NOTICE TO RECIPIENT: If you are not the intended recipient of this
e-mail, you are prohibited from sharing, copying, or otherwise using or
disclosing its contents. If you have received this e-mail in error,
please notify the sender immediately by reply e-mail and permanently
delete this e-mail and any attachments without reading, forwarding or
saving them. Thank you.
- Forwarded by Bala T Ramanadham/CA/KAIPERM on 06/19/2009 07:39 AM
-
Bala T Ramanadham/CA/kaip...@kaiperm
06/11/2009 05:27 PM
Please respond to
Struts Users Mailing List user@struts.apache.org
To
user@struts.apache.org
cc
Subject
Struts2 dynamic tree error
Using the below code to create a tree reading DB.
sx:tree id=cus rootNode=customers nodeIdProperty=id
nodeTitleProperty=customer childCollectionProperty=customer /
customersis an Array List and customeris an object.
Below is the error. Please help
6/11/09 17:17:01:000 PDT] 0084 runtime E
Expression stack.findValue(parameters.nodeTitleProperty) is undefined on
line 23, column 48 in template/ajax/treenode-include.ftl.
The problematic instruction:
--
== ${stack.findValue(parameters.nodeTitleProperty)} [on line 23, column
46 in template/ajax/treenode-include.ftl]
in include /${parameters.templateDir}/ajax/treenode-include.ftl [on
line 124, column 5 in template/ajax/tree.ftl]
--
Java backtrace for programmers:
--
freemarker.core.InvalidReferenceException: Expression
stack.findValue(parameters.nodeTitleProperty) is undefined on line 23,
column 48 in template/ajax/treenode-include.ftl.
Thanks Regards
Bala T Ramanadham
NOTICE TO RECIPIENT: If you are not the intended recipient of this
e-mail, you are prohibited from sharing, copying, or otherwise using or
disclosing its contents. If you have received this e-mail in error,
please notify the sender immediately by reply e-mail and permanently
delete this e-mail and any attachments without reading, forwarding or
saving them. Thank you.
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org