Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by raj on Mar 20, 2008 02:35
open dhtmlx forum
regarding the tree building from a request data

Hi,

I am using dhtmlxtree to build the tree, here my application is a java web application, I am using jsps at UI side.

In my jsp(Example.jsp) I am using the below code to build the tree:

<div id="treebox_tree2" style="width:400; height:280;background-color:#FFFFFF;border :1px solid Silver;; overflow:auto;"></div>
var tree=new dhtmlXTreeObject("treebox_tree","100%","100%",0);


if(tree != null && typeof(tree) != "undefined"){

tree.setImagePath("images/treeImgs/");
tree.enableSmartRendering(true);
tree.setXMLAutoLoading("jsp/ExampleXml.jsp");
tree.loadXML("jsp/ExampleXml.jsp?id=0");
}

What my problem is I am getting the data from the server side to jsp through request attribute,
but I am unable to read the data from the request attribute in my EmployeeXML.jsp, because here in Employee.jsp we are making a new request to build the tree iin EmployeeXML.jsp.

So to eliminate this problem, I have used session attribute to read the data in EmployeeXML.jsp.

Please suggest me regarding this to avoid session in EmployeeXML.jsp, I want to use request instead of session.

Here is my EmployeeXML.jsp :

<?xml version="1.0" encoding="iso-8859-1"?>
<tree id="0">
<%
int count = 0;
EmployeeTableVO employeeTableVO = (EmployeeTableVO )session.getAttribute("employeeTableVO ");

if(employeeTableVO != null){

%>
<item text="<%=employeeTableVO .getEmpName()%>-<%=employeeTableVO .getEmpCode()%>" id="<%=++count%>" im0="1.GIF" im1="2.GIF" im2="3.GIF">

</item>
<%
} %>
</tree>
Answer posted by Support on Mar 20, 2008 06:31
>>Please suggest me regarding this to avoid session in EmployeeXML.jsp, I want to use request instead of session.

The grid can load XML data directly from XML string, so it possible to use

    tree.loadXMLString("<%  some jsp code which will output XML string  %>");

So the XML will be built on the same page where tree loaded and you will need session parameters.