:: Forum >> Version 1 >>
How can I populate the grid using data from a java bean?
Hi,
I am a newbee to the Java world. ia m trying to create a simple page with a table that is populated from a session bean. I have a property in the bean that is an array list of the data that needs to be displayed as a table on my jsp page.
I need to access this bean array and use that array to populate the widget grid. I have been looking at code sample for <jsp:useBean> but can't seem to get the array property assigned to a javascript array.
How do I get the bean array assigned to a javascript array and thereby populate the grid?
Thanks in advance!
MN
Thursday, August 11, 2005
Fill the data in your jsp page like this.
mydata = [];
row = ["<%=some java code holding your value>"]
mydata.push (row);
Do it in a loop and look to the other examples
Success
Thursday, August 11, 2005
Hi,
That did help get the data from the bean into my array. Thanks! However I seem to be having problems displaying the data in the grid now.
After havind populated the array in the manner you have suggested, I tried to populate the grid with the example code:
obj.setDataText(function(i,j){return myData[i][j]});
This results in a "No Data Found" message. How do I populate the grid with the myData array?
Thanks again for all the help!
MN
Thursday, August 11, 2005
I used mydata without capitals did you copy that? Then you have to use:
obj.setDataText(function(i,j){return mydata[i][j]});
check if it's filled right with alert (mydata.length) or alert (myData.length) depending on the name of your array.
Friday, August 12, 2005
This topic is archived.
Back to support forum
Forum search