Geekzone: technology news, blogs, forums
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.

1 post

Wannabe Geek

# 39997 23-Aug-2009 03:12
Send private message

I'm newbie in jsp .....
I try to make little program using menu tree with jsp, struts tiles
but it can't view the last node of tree menu called in the next's only call root of menu
the tree always reload when a page is called so that next position node of tree is different from a page before
I'm posting is very long
please help me..

thanks a lot

================= dynamicTree.jsp ==================================

dojo.addOnLoad(function() {

dojo.lang.mixin(dojo.widget.byId('treeController'), dojo.widget.TreeControllerExtension.prototype);


<div dojoType="TreeLoadingController" widgetId="treeController" RPCUrl="tree_gettreenodes.action"></div>

<dojo:TreeSelector widgetId="treeSelector_contentTree" eventNames="select:treeSelected;" > </dojo:TreeSelector>
<div dojoType="Tree" id="contentTree" selector="treeSelector_contentTree" controller="treeController" toggle="fade">
<div dojoType="TreeNode" title="<sroperty value=""/>"
id="<sroperty value=""/>" isFolder="true"> </div>


<package name="system" extends="tiles-default">
<action name="Home" method="gettree" class="ptdh.mis.icma.action.HomeAction">
<result name="success" type="tiles">homePage</result>

<action name="tree_*" method="{1}"

<action name="SearchEmployee" class="ptdh.mis.icma.action.PtdhCardAction" method="searchEmployee">
<result name="input" type="tiles">overrideSearchEmployee</result>

===============================myTilesConfigFile.xml ===============

<definition name="homePage" template="/WEB-INF/jsp/template.jsp">
<put-attribute name="header" value="/WEB-INF/jsp/defaultHeader.jsp" />
<put-attribute name="menu" value="/WEB-INF/jsp/dynamicTree.jsp" />
<put-attribute name="body" value="/WEB-INF/jsp/home_body.jsp" />
<put-attribute name="footer" value="/WEB-INF/jsp/defaultFooter.jsp" />

<definition name="overrideSearchEmployee" extends="homePage">
<put-attribute name="body" value="/WEB-INF/jsp/searchEmployeeForm.jsp" />

static {
new Category(1, "Root ", "",
new Category(2, "PTDH Card ", "",
new Category(3, " <a href='SearchEmployee.action'> "+"Create News ", " "),
new Category(4, " <a href='SearchPtdhCard.action'> "+"Search/Update ", " ")),
new Category(5, "Sub Contractor Card ","",
new Category(6, " <a href='AddSubconUser.action'> "+"Create New ", " "),
new Category(7, " <a href='SearchSubconCard.action'> "+"Search/Update ", " ")),

new Category(8, "Report", "",
new Category(9, " <a href='PtdhCardActiveExecution.action'> "+"PTDH Active Report ", " "),
new Category(10, " <a href='SubconCardActiveExecution.action'> "+"Sub Contractor Active Report ", " "))


public static Category getById(long id) {
return catMap.get(id);

public Category(long id, String name, String linkAddress,Category... children) { = id; = name;
this.linkAddress = linkAddress;
this.children = new ArrayList<Category>();
for (Category child : children) {

catMap.put(id, this);
} =======================

public String gettree(){
Category rootNode = Category.getById(1);
request.setAttribute("rootNode", rootNode);
return SUCCESS;

public String gettreenodes(){
JSONObject jsonData,node;
PrintWriter writer;
try {

jsonData = new JSONObject(data);
node = jsonData.getJSONObject("node");
String nodeId = node.get("widgetId").toString();
Category category = Category.getById(Long.parseLong(nodeId));
JSONStringer stringer = new JSONStringer();

List<Category> children = category.getChildren();
for (int i=0;i<children.size();i++){
Category childCategory = children.get(i);
stringer.value(childCategory.getChildren().size()>0 ? true : false);

writer = response.getWriter();

} catch (JSONException e) {
} catch (IOException e) {
return null;


Create new topic
8033 posts

Uber Geek
+1 received by user: 390


  # 249836 23-Aug-2009 16:25
Send private message

Use for posting code snippets, I'm unlikely to spend the time dechipering your post in it's current state.

Create new topic

Twitter and LinkedIn »

Follow us to receive Twitter updates when new discussions are posted in our forums:

Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:

Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:

News »

Dunedin selects Telensa to deliver smart street lighting for 15,000 LEDs
Posted 18-Jul-2019 10:21

Sprint announces a connected wallet card with built-in IoT support
Posted 18-Jul-2019 08:36

Educational tool developed at Otago makes international launch
Posted 17-Jul-2019 21:57

Symantec introduces cloud access security solution
Posted 17-Jul-2019 21:48

New Zealand government unveils new digital service to make business easier
Posted 16-Jul-2019 17:35

Scientists unveil image of quantum entanglement
Posted 13-Jul-2019 06:00

Hackers to be challenged at University of Waikato
Posted 12-Jul-2019 21:34

OPPO Reno Z now available in New Zealand
Posted 12-Jul-2019 21:28

Sony introduces WF-1000XM3 wireless headphones with noise cancellation
Posted 8-Jul-2019 16:56

Xero announces new smarter tools, push into the North American market
Posted 19-Jun-2019 17:20

New report by Unisys shows New Zealanders want action by social platform companies and police to monitor social media sites
Posted 19-Jun-2019 17:09

ASB adds Google Pay option to contactless payments
Posted 19-Jun-2019 17:05

New Zealand PC Market declines on the back of high channel inventory, IDC reports
Posted 18-Jun-2019 17:35

Air New Zealand uses drones to inspect aircraft
Posted 17-Jun-2019 15:39

TCL Electronics launches its first-ever 8K TV
Posted 17-Jun-2019 15:18

Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.

Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron

Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.