Results 1 to 2 of 2
  1. #1
    visiau is offline Member
    Join Date
    Aug 2009
    Posts
    2
    Rep Power
    0

    Default Retrieve Node of tree in next page using jsp, struts tiles

    '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 page.it's only call root of menu
    i want to save and view the last node of tree in next page
    please help me...thx

    ================= dynamicTree.jsp ==========================
    <html>
    <head>
    <s:head theme="ajax" debug="true"/>
    <script>

    //Load the tree controller and extensions
    dojo.require("dojo.widget.TreeLoadingController");
    dojo.require("dojo.widget.TreeControllerExtension" );

    dojo.require("dojo.lang.*");
    dojo.require("dojo.widget.*");
    dojo.require("dojo.widget.Tree");
    dojo.require("dojo.widget.TreeRPCController");

    dojo.require("dojo.widget.TreeNode");
    dojo.require("dojo.widget.TreeSelector");
    dojo.require("dojo.widget.TreeRPCController");
    dojo.require("dojo.widget.TreeContextMenu");


    dojo.addOnLoad(function() {
    //Add the extensions to the controller
    System.out.println("\n\n>>>>>>>>>>>>>>>>>>>>>> DynamicTree == dojo.widget.byId(treeController) ; "+dojo.widget.byId('treeController'));
    System.out.println("\n\n>>>>>>>>>>>>>>>>>>>>>> DynamicTree == dojo.widget.TreeControllerExtension.prototype ; "+dojo.widget.TreeControllerExtension.prototyp e);

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

    //The following code will make sure that the saveExpandedIndices function is called everytime a node
    //is collapsed or expanded
    dojo.event.topic.subscribe("contentTree/expand",saveExpandedIndices);
    dojo.event.topic.subscribe("contentTree/collapse",saveExpandedIndices);

    System.out.println("\n\n>>>>>>>>>>>>>>>>>>>>>> DynamicTree == saveExpandedIndices; "+saveExpandedIndices);


    });

    function saveExpandedIndices(message) {
    indices = dojo.widget.byId('treeController').saveExpandedInd ices(
    dojo.widget.byId('contentTree')
    );
    if (readCookie("categoryTreeState")==null)
    createCookie("categoryTreeState",indices.toJSONStr ing());
    else
    updateCookie("categoryTreeState",indices.toJSONStr ing());
    }


    function restoreExpandedIndices(indices) {
    dojo.widget.byId('treeController').restoreExpanded Indices(
    dojo.widget.byId('contentTree'), indices
    );
    }
    function bodyOnLoad(){
    treeState = readCookie("categoryTreeState");
    indices = treeState.parseJSON();
    restoreExpandedIndices(indices);
    }

    </script>

    </head>
    <body onload="bodyOnLoad()">

    <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="<s:property value="#request.rootNode.name"/>"
    id="<s:property value="#request.rootNode.id"/>" isFolder="true"> </div>
    </div>

    </body>
    </html>
    ===================struts.xml===================== ==========
    <struts>

    <constant name="struts.objectFactory" value="spring" />
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="false" />
    <package name="default" extends="struts-default">
    <result-types>
    <result-type name="jasper"
    class="org.apache.struts2.views.jasperreports.Jasp erReportsResult" />
    </result-types>

    <action name="GoLogout" class="ptdh.mis.icma.action.LoginAction"
    method="goLogout">
    <result name="success">/WEB-INF/jsp/logout.jsp
    </result>
    </action>

    <action name="SearchEmployeeExecution" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doSearchEmployee">
    <result name="input">/WEB-INF/jsp/searchEmployeeForm.jsp
    </result>
    <result name="success">/WEB-INF/jsp/ptdhUserForm.jsp
    </result>
    </action>

    <action name="SavePtdhCard" class="ptdh.mis.icma.action.PtdhCardAction"
    method="savePtdhCard">
    <result name="input">/WEB-INF/jsp/ptdhUserForm.jsp
    </result>
    <result name="success">/WEB-INF/jsp/ptdhKimperForm.jsp
    </result>
    <result name="none">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    </action>

    <action name="SaveRenewalPtdhCard" class="ptdh.mis.icma.action.PtdhCardAction"
    method="saveRenewalPtdhCard">
    <result name="input">/WEB-INF/jsp/ptdhUserForm.jsp
    </result>
    <result name="success">/WEB-INF/jsp/ptdhKimperForm.jsp
    </result>
    <result name="none">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    </action>

    <action name="InputKimper" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doInputKimper">
    <result name="success">/WEB-INF/jsp/addPtdhKimperForm.jsp
    </result>
    </action>

    <action name="InputKimperExecution" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doShowKimper">
    <result name="success">/WEB-INF/jsp/ptdhKimperForm.jsp
    </result>
    <result name="input">/WEB-INF/jsp/addptdhKimperForm.jsp
    </result>
    </action>

    <action name="DoNothingKimper" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doNothingKimper">
    <result name="success">/WEB-INF/jsp/ptdhKimperForm.jsp
    </result>
    </action>

    <action name="DeleteKimper" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doDeleteKimper">
    <result name="success">/WEB-INF/jsp/ptdhKimperForm.jsp
    </result>
    </action>

    <action name="UpdateKimper" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doUpdateKimper">
    <result name="input">/WEB-INF/jsp/addPtdhKimperForm.jsp
    </result>
    </action>

    <action name="PrintPtdhCard" class="ptdh.mis.icma.action.PtdhCardAction"
    method="printPtdhCard">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    </action>

    <action name="PrintPtdhCardNonPermit" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardNonPermit">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardNonPit" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardNonPit">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-NonPIT.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardPermitSide21" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardPermitSide21">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-Kimperpermit-Side2.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardPermitExt22" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardPermitExt22">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-Sekunder-KimperPermit.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardPermitSide22" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardPermitSide22">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-Kimperpermit-Side2.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardPermitExt23" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardPermitExt23">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-Sekunder-KimperPermit.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardPermitSide23" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardPermitSide23">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-Kimperpermit-Side2.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardNonPermitSide2" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardNonPermitSide2">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-side2.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardKimperPermit" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardKimperPermit">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-KimperPermit.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardKimperPermitAllVehc" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardKimperPermitAllVehc">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-KimperPermit-HV.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardNonPitKimperPermit" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardNonPitKimperPermit">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-NonPIT-KimperPermit.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardNonPitPort" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardNonPitPort">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-NonPIT-Port.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardNonPermitPort" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardNonPermitPort">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-Port.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardKimperPermitPort" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardKimperPermitPort">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-KimperPermit-Port.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardKimperPermitAllVehcPort" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardKimperPermitAllVehcPort">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-KimperPermit-HV-Port.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardNonPitKimperPermitPort" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhCardNonPitKimperPermitPort">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-NonPIT-KimperPermit-Port.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhDangerTagCard" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhDangerTagCard">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-DangerTag.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhDangerTagCardEng" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhDangerTagCard">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-DangerTag-Eng.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhIsolationTagCard" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhIsolationTagCard">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-IsolationTag.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhIsolationTagCardEng" class="ptdh.mis.icma.action.PtdhCardAction"
    method="doPrintPtdhIsolationTagCard">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-IsolationTag-Eng.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    </result>
    </action>

    <action name="SaveSubconCard" class="ptdh.mis.icma.action.SubconCardAction"
    method="saveSubconCard">
    <result name="input">/WEB-INF/jsp/subconUserForm.jsp
    </result>
    <result name="success">/WEB-INF/jsp/subconKimperForm.jsp
    </result>
    <result name="none">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    </action>

    <action name="SaveRenewalSubconCard" class="ptdh.mis.icma.action.SubconCardAction"
    method="saveRenewalSubconCard">
    <result name="input">/WEB-INF/jsp/subconUserForm.jsp
    </result>
    <result name="success">/WEB-INF/jsp/subconKimperForm.jsp
    </result>
    <result name="none">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    </action>

    <action name="InputSubconKimper" class="ptdh.mis.icma.action.SubconCardAction"
    method="doInputSubconKimper">
    <result name="success">/WEB-INF/jsp/addSubconKimperForm.jsp
    </result>
    </action>

    <action name="InputSubconKimperExecution" class="ptdh.mis.icma.action.SubconCardAction"
    method="doShowSubconKimper">
    <result name="input">/WEB-INF/jsp/subconKimperForm.jsp
    </result>
    </action>

    <action name="DoNothingSubconKimper" class="ptdh.mis.icma.action.SubconCardAction"
    method="doNothingSubconKimper">
    <result name="success">/WEB-INF/jsp/subconKimperForm.jsp
    </result>
    </action>

    <action name="DeleteSubconKimper" class="ptdh.mis.icma.action.SubconCardAction"
    method="doDeleteSubconKimper">
    <result name="success">/WEB-INF/jsp/subconKimperForm.jsp
    </result>
    </action>

    <action name="UpdateSubconKimper" class="ptdh.mis.icma.action.SubconCardAction"
    method="doUpdateSubconKimper">
    <result name="input">/WEB-INF/jsp/addSubconKimperForm.jsp
    </result>
    </action>

    <action name="PrintSubconCard" class="ptdh.mis.icma.action.SubconCardAction"
    method="printSubconCard">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    </action>

    <action name="PrintSubconCardExecution" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCard">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <!-- KPC Card -->

    <action name="PrintPtdhCardNonPermitKpc" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintPtdhCardNonPermitKpc">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-KPC.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardNonPitKpc" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintPtdhCardNonPitKpc">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-NonPIT-KPC.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintKpcCardNonPermitSide2" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardNonPermitSide2">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">kpc-side2.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardKimperPermitKpc" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintPtdhCardKimperPermitKpc">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-KimperPermit-KPC.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardKimperPermitAllVehcKpc" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintPtdhCardKimperPermitAllVehcKpc">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-KimperPermit-HV-KPC.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardNonPitKimperPermitKpc" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintPtdhCardNonPitKimperPermitKpc">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-NonPIT-KimperPermit-KPC.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintKpcCardPermitSide21" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardPermitSide21">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">kpc-Kimperpermit-Side2.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintKpcCardPermitExt22" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardPermitExt22">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-Sekunder-Kimperpermit.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintKpcCardPermitSide22" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardPermitSide22">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">kpc-Kimperpermit-Side2.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintKpcCardPermitExt23" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardPermitExt23">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-Sekunder-Kimperpermit.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintKpcCardPermitSide23" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardPermitSide23">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">kpc-Kimperpermit-Side2.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardNonPitPortKpc" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintPtdhCardNonPitPortKpc">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-NonPIT-Port-KPC.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardNonPermitPortKpc" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintPtdhCardNonPermitPortKpc">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-Port-KPC.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardKimperPermitPortKpc" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintPtdhCardKimperPermitPortKpc">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-KimperPermit-Port-KPC.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardKimperPermitAllVehcPortKpc" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintPtdhCardKimperPermitAllVehcPortKpc" >
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-KimperPermit-HV-Port-KPC.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintPtdhCardNonPitKimperPermitPortKpc" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintPtdhCardNonPitKimperPermitPortKpc">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">ptdhcard-NonPIT-KimperPermit-Port-KPC.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>


    <action name="PrintKpcDangerTagCard" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintKpcDangerTagCard">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-DangerTag.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintKpcDangerTagCardEng" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintKpcDangerTagCard">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-DangerTag-Eng.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintKpcIsolationTagCard" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintKpcIsolationTagCard">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-IsolationTag.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintKpcIsolationTagCardEng" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintKpcIsolationTagCard">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-IsolationTag-Eng.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>


    <!-- subcon card -->

    <action name="PrintSubconCardNonPit" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardNonPit">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-NonPIT.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardNonPermitSide2" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardNonPermitSide2">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-side2.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardNonPermit" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardNonPermit">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardKimperPermit" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardKimperPermit">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-KimperPermit.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardKimperPermitAllVehc" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardKimperPermitAllVehc">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-KimperPermit-HV.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardNonPitKimperPermit" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardNonPitKimperPermit">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-NonPIT-KimperPermit.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardPermitSide21" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardPermitSide21">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-Kimperpermit-Side2.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardPermitExt22" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardPermitExt22">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-Sekunder-Kimperpermit.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardPermitSide22" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardPermitSide22">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-Kimperpermit-Side2.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardPermitExt23" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardPermitExt23">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-Sekunder-Kimperpermit.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardPermitSide23" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardPermitSide23">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-Kimperpermit-Side2.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardNonPermitPort" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardNonPermitPort">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-Port.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardNonPitPort" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardNonPitPort">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-NonPIT-Port.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardNonPitKimperPermitPort" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardNonPitKimperPermitPort">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-NonPIT-KimperPermit-Port.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardKimperPermitPort" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardKimperPermitPort">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-KimperPermit-Port.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconCardKimperPermitAllVehcPort" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconCardKimperPermitAllVehcPort">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-KimperPermit-HV-Port.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconDangerTagCard" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconDangerTagCard">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-DangerTag.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconDangerTagCardEng" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconDangerTagCard">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-DangerTag-Eng.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconIsolationTagCard" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconIsolationTagCard">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-IsolationTag.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <action name="PrintSubconIsolationTagCardEng" class="ptdh.mis.icma.action.SubconCardAction"
    method="doPrintSubconIsolationTagCard">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">subconcard-IsolationTag-Eng.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    </result>
    </action>

    <!-- Search PTDH Card -->

    <action name="SearchPtdhCardExecution" class="ptdh.mis.icma.action.PtdhCardAction"
    method="searchPtdhCardExecution">
    <result name="success">/WEB-INF/jsp/searchPtdhCardForm.jsp
    </result>
    <result name="input">/WEB-INF/jsp/searchPtdhCardForm.jsp
    </result>
    </action>

    <action name="PrintSearchPtdhKimper" class="ptdh.mis.icma.action.PtdhCardAction"
    method="printPtdhCard">
    <result name="input">/WEB-INF/jsp/printPtdhCardForm.jsp
    </result>
    </action>

    <action name="UpdateSearchPtdhKimper" class="ptdh.mis.icma.action.PtdhCardAction"
    method="updatePtdhCard">
    <result name="success">/WEB-INF/jsp/ptdhKimperForm.jsp
    </result>
    </action>

    <action name="ReviewSearchPtdhKimper" class="ptdh.mis.icma.action.PtdhCardAction"
    method="reviewSearchPtdhKimper">
    <result name="success">/WEB-INF/jsp/reviewPtdhCard.jsp
    </result>
    </action>

    <action name="RenewalPtdhCard" class="ptdh.mis.icma.action.PtdhCardAction"
    method="renewalPtdhCard">
    <result name="success">/WEB-INF/jsp/ptdhUserForm.jsp
    </result>
    </action>

    <!-- Search Subcon Card -->

    <action name="SearchSubconCardExecution" class="ptdh.mis.icma.action.SubconCardAction"
    method="searchSubconCardExecution">
    <result name="success">/WEB-INF/jsp/searchSubconCardForm.jsp
    </result>
    <result name="input">/WEB-INF/jsp/searchSubconCardForm.jsp
    </result>
    </action>

    <action name="PrintSearchSubconKimper" class="ptdh.mis.icma.action.SubconCardAction"
    method="printSubconCard">
    <result name="input">/WEB-INF/jsp/printSubconCardForm.jsp
    </result>
    </action>

    <action name="UpdateSearchSubconKimper" class="ptdh.mis.icma.action.SubconCardAction"
    method="updateSubconCard">
    <result name="success">/WEB-INF/jsp/subconKimperForm.jsp
    </result>
    </action>

    <action name="ReviewSearchSubconKimper" class="ptdh.mis.icma.action.SubconCardAction"
    method="reviewSearchSubconKimper">
    <result name="success">/WEB-INF/jsp/reviewSubconCard.jsp
    </result>
    </action>

    <action name="RenewalSubconCard" class="ptdh.mis.icma.action.SubconCardAction"
    method="renewalSubconCard">
    <result name="success">/WEB-INF/jsp/subconUserForm.jsp
    </result>
    </action>

    <!-- REPORT -->
    <action name="report" class="ptdh.mis.icma.action.ReportAction">
    <result name="success">/WEB-INF/jsp/reportForm.jsp
    </result>
    </action>
    <action name="downloadreport" class="ptdh.mis.icma.action.ReportAction">
    <result name="success">/WEB-INF/jsp/downloadForm.jsp
    </result>
    </action>
    <action name="ptdhActive" class="ptdh.mis.icma.action.ReportAction"
    method="doPtdhActiveReport">
    <result name="success">/WEB-INF/jsp/ptdhActiveReportForm.jsp
    </result>
    </action>

    <action name="subconActive" class="ptdh.mis.icma.action.ReportAction"
    method="doSubconActiveReport">
    <result name="success">/WEB-INF/jsp/subconActiveReportForm.jsp
    </result>
    </action>

    <action name="ptdhExpired" class="ptdh.mis.icma.action.ReportAction"
    method="doPtdhExpiredReport">
    <result name="success">/WEB-INF/jsp/ptdhExpiredReportForm.jsp
    </result>
    </action>

    <action name="subconExpired" class="ptdh.mis.icma.action.ReportAction"
    method="doSubconExpiredReport">
    <result name="success">/WEB-INF/jsp/subconExpiredReportForm.jsp
    </result>
    </action>

    <action name="ptdhKimper" class="ptdh.mis.icma.action.ReportAction"
    method="doPtdhKimperReport">
    <result name="success">/WEB-INF/jsp/ptdhKimperReportFormList.jsp
    </result>
    </action>

    <action name="subconKimper" class="ptdh.mis.icma.action.ReportAction"
    method="doSubconKimperReport">
    <result name="success">/WEB-INF/jsp/subconKimperReportFormList.jsp
    </result>
    </action>


    <action name="ptdhCardExpiredExecution" class="ptdh.mis.icma.action.ReportAction"
    method="ptdhExpiredReport">
    <result name="input">/WEB-INF/jsp/ptdhExpiredReportForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">/reportTemplate/idcard-expired.jasper</param>
    <param name="dataSource">ptdhCardDS</param>
    <param name="format">PDF</param>
    </result>
    </action>

    <action name="subconCardExpiredExecution" class="ptdh.mis.icma.action.ReportAction"
    method="subconExpiredReport">
    <result name="input">/WEB-INF/jsp/subconExpiredReportForm.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">/reportTemplate/idcard-expired-subcon.jasper</param>
    <param name="dataSource">subconCardDS</param>
    <param name="format">PDF</param>
    </result>
    </action>

    <action name="ptdhKimperListExecution" class="ptdh.mis.icma.action.ReportAction"
    method="ptdhKimperReport">
    <result name="input">/WEB-INF/jsp/ptdhKimperReportFormList.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">/reportTemplate/list-kimper-ptdh.jasper</param>
    <param name="dataSource">ptdhCardReportDS</param>
    <param name="format">PDF</param>
    </result>
    </action>

    <action name="subconKimperListExecution" class="ptdh.mis.icma.action.ReportAction"
    method="subconKimperReport">
    <result name="input">/WEB-INF/jsp/subconKimperReportFormList.jsp
    </result>
    <result name="success" type="jasper">
    <param name="location">/reportTemplate/list-kimper-subcon.jasper</param>
    <param name="dataSource">subconCardReportDS</param>
    <param name="format">PDF</param>
    </result>
    </action>



    <action name="Login" class="ptdh.mis.icma.action.LoginAction">
    <result name="input">/WEB-INF/jsp/login.jsp
    </result>
    <result name="success" type="redirect-action">
    <param name="actionName">Home</param>
    </result>
    </action>

    <action name="Synchronize" class="ptdh.mis.icma.action.HomeAction"
    method="Synchronize">
    <result name="success" type="redirect-action">
    <param name="actionName">Home</param>
    </result>
    </action>


    </package>

    <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>

    <action name="tree_*" method="{1}"
    class="ptdh.mis.icma.action.HomeAction">
    <result>/WEB-INF/jsp/dynamicTree.jsp</result>
    </action>

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

    <action name="SearchPtdhCard" class="ptdh.mis.icma.action.PtdhCardAction" method="searchPtdhCard">
    <result name="input" type="tiles">overrideSearchPtdhCard</result>
    </action>

    <action name="AddSubconUser" class="ptdh.mis.icma.action.SubconCardAction" method="addSubconUser">
    <result name="input" type="tiles"> overrideAddSubconUser </result>
    </action>

    <action name="SearchSubconCard" class="ptdh.mis.icma.action.SubconCardAction" method="searchSubconCard">
    <result name="input" type="tiles">overrideSearchSubconCard </result>
    </action>


    <action name="PtdhCardActiveExecution" class="ptdh.mis.icma.action.ReportAction" method="ptdhActiveReport">
    <result name="input" type="tiles">overridePtdhCardActiveExecution </result>
    <!-- <result name="success" type="jasper">
    <param name="location">/reportTemplate/idcard-active.jasper</param>
    <param name="dataSource">ptdhCardDS</param>
    <param name="format">PDF</param>
    </result> -->

    </action>



    <action name="SubconCardActiveExecution" class="ptdh.mis.icma.action.ReportAction" method="subconActiveReport">
    <result name="input">overrideSubconCardActiveExecution </result>
    <!-- <result name="success" type="jasper">
    <param name="location">/reportTemplate/idcard-active-subcon.jasper</param>
    <param name="dataSource">subconCardDS</param>
    <param name="format">PDF</param>
    </result> -->
    </action>

    </package>

    </struts>
    ===============================myTilesConfigFile.x ml =========
    <tiles-definitions>
    <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>

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

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

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

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

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

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

    </tiles-definitions>

    ========================category.java============= ==========
    package ptdh.mis.icma.tree;

    public class Category extends BaseAction{
    private static Map<Long, Category> catMap = new HashMap<Long, Category>();
    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);
    }

    private long id;
    private String name;
    private String linkAddress;
    private List<Category> children;
    private boolean toggle;

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

    catMap.put(id, this);

    // EventSource.loadJSON(json_events, document.location.href);
    }

    public String getLinkAddress() {
    return linkAddress;
    }

    public void setLinkAddress(String linkAddress) {
    this.linkAddress = linkAddress;
    }

    public long getId() {
    return id;
    }

    public void setId(long id) {
    this.id = id;
    }

    public String getName() {
    return name;
    }

    public void setName(String name) {
    this.name = name;
    }

    public List<Category> getChildren() {
    return children;
    }

    public void setChildren(List<Category> children) {
    this.children = children;
    }

    public void toggle() {
    toggle = !toggle;
    }

    public boolean isToggle() {
    return toggle;
    }
    }
    =========================HomeAction.java =================

    package ptdh.mis.icma.action;

    public class HomeAction extends BaseAction implements SessionAware, ServletContextAware, ServletResponseAware, ServletRequestAware {

    private InitServlet is;
    private List<Company> company;

    private static final long serialVersionUID = -9131739831820245692L;
    //private String data;
    private HttpServletResponse response;
    private HttpServletRequest request;

    public String getData() {
    return data;
    }

    public void setData(String data) {
    this.data = data;
    }

    public void setServletResponse(HttpServletResponse response) {
    this.response = response;
    }

    public void setServletRequest(HttpServletRequest request){
    this.request = request;
    }

    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();

    stringer.array();
    //
    List<Category> children = category.getChildren();
    for (int i=0;i<children.size();i++){
    Category childCategory = children.get(i);
    stringer.object();
    stringer.key("id");
    stringer.value(childCategory.getId());
    stringer.key("title");
    stringer.value(childCategory.getName());
    stringer.key("isFolder");
    stringer.value(childCategory.getChildren().size()> 0 ? true : false);
    stringer.endObject();
    }
    stringer.endArray();

    writer = response.getWriter();

    writer.write(stringer.toString());

    } catch (JSONException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    }

    return null;

    } @Override
    public String execute() throws Exception {
    return SUCCESS;
    }

    public String Synchronize() throws Exception{
    //is = new InitServlet();
    is.init();
    return SUCCESS;
    }

    public void setCompany(List<Company> company) {
    this.company = company;
    }

    public List<Company> getCompany() {
    return company;
    }
    }

  2. #2
    visiau is offline Member
    Join Date
    Aug 2009
    Posts
    2
    Rep Power
    0

    Default Revision : Retrieve Node of tree in next page using jsp, struts tiles

    I'm sorry..my posting is very long
    the tree always reload when a page is called so that last position node of tree is different from a page before
    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="#request.rootNode.name"/>"
    id="<sroperty value="#request.rootNode.id"/>" isFolder="true"> </div>
    </div>

    ===================struts.xml===================== ================


    <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>

    <action name="tree_*" method="{1}"
    class="ptdh.mis.icma.action.HomeAction">
    <result>/WEB-INF/jsp/dynamicTree.jsp</result>
    </action>


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

    ===============================myTilesConfigFile.x ml ===============

    <tiles-definitions>
    <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>

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


    </tiles-definitions>

    ========================category.java============= ===============
    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) {
    this.id = id;
    this.name = name;
    this.linkAddress = linkAddress;
    this.children = new ArrayList<Category>();
    for (Category child : children) {
    this.children.add(child);
    }

    catMap.put(id, this);
    }

    =========================HomeAction.java =======================


    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();

    stringer.array();
    List<Category> children = category.getChildren();
    for (int i=0;i<children.size();i++){
    Category childCategory = children.get(i);
    stringer.object();
    stringer.key("id");
    stringer.value(childCategory.getId());
    stringer.key("title");
    stringer.value(childCategory.getName());
    stringer.key("isFolder");
    stringer.value(childCategory.getChildren().size()> 0 ? true : false);
    stringer.endObject();
    }
    stringer.endArray();

    writer = response.getWriter();
    writer.write(stringer.toString());

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


    }
    ================================================== ==========

Similar Threads

  1. to retrieve the webcontent from another page source
    By rameshsathasivam in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 11-25-2008, 08:41 AM
  2. [SOLVED] Navigate from a tiles to another page
    By hannehomuth in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 09-04-2008, 04:56 PM
  3. Common error page using struts tiles...?
    By prabhurangan in forum Web Frameworks
    Replies: 0
    Last Post: 08-28-2008, 02:34 PM
  4. Replies: 2
    Last Post: 06-03-2008, 09:07 PM
  5. struts tiles
    By sasikumarm in forum Web Frameworks
    Replies: 0
    Last Post: 03-27-2008, 02:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •