Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

jmaki dojo table columns from java bean

Status
Not open for further replies.

dangari

Programmer
Aug 5, 2009
9
KE
Hi all.My problem is pretty simple.I have been able to load data onto the table from a bean in my jsp page as follows:
//top of page i have these
Code:
<%@ taglib prefix="a" uri="[URL unfurl="true"]http://jmaki/v1.0/jsp"[/URL] %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="loy" scope="session" class="loy.generate" />
<jsp:setProperty name="loy" property="*" />
//for the dojo table i have this:
Code:
<a:widget name="dojo.table" value="{columns: ${loy.fssRegCols},rows : ${loy.fssReg}}"/>
//please note that the rows come fine but columns come as integers 0 to 9 their positons.Here is my code in java class generate.java that loads the column names.Here is the place that i need help with.
Code:
public JSONArray getFssRegCols() throws Exception
{
JSONArray books = new JSONArray();
JSONArray book = new JSONArray();
String [][] dataz = new String [10][2];
dataz[0][0]="label : ''MOBILE''";
dataz[1][0]="label : ''NAME''";
dataz[2][0]="label : ''ID_CARD_NO''";
dataz[3][0]="label : ''DEALER_NO.''";
dataz[4][0]="label : ''DATE_OF_BIRTH''";
dataz[5][0]="label : ''REG_DATE_TIME''";
dataz[6][0]="label : ''GENDER''";
dataz[7][0]="label : ''DEALER_SHOP''";
dataz[8][0]="label : ''TOWN''";
dataz[9][0]="label : ''ACTION''";
dataz[0][1]="id : ''mobile''";
dataz[1][1]="id : ''name''";
dataz[2][1]="id : ''idno''";
dataz[3][1]="id : ''dealer''";
dataz[4][1]="id : ''dob''";
dataz[5][1]="id : ''redate''";
dataz[6][1]="id : ''gender''";
dataz[7][1]="id : ''shop''";
dataz[8][1]="id : ''tao''";
dataz[9][1]="id : ''act''";
for(int m=0;m<dataz.length;m++)
{
int j=0;
j=0;
while(j<(dataz[0].length))
{
book.put(dataz[m][j]);
j++;
}
books.put(book);
book = new JSONArray();
}
return books;
}
My main question is why the column names don't show and instead numbers 0 to 9 pressumably the array indexes are returned instead?
Thank you all and know that your help is well appreciated.

Let me explain further what I'm faced with here.
Now by hard coding the columns as follows on the jsp page ,but using the bean for the rows, everything is fine:
Code:
<a:widget name="dojo.table" value="{columns: [{label : 'MOBILE',id : 'mobile'},
{label : 'NAME',id : 'name'},
{label : 'ID CARD NO',id : 'idno'},
{label : 'DEALER NO',id : 'dealer'},
{label : 'DEALER SHOP',id : 'dshop'},
{label : 'GENDER',id : 'gender'},
{label : 'REG DATE TIME',id : 'regdate'},
{label : 'TOWN',id : 'tao'},
{label : 'DATE OF BIRTH',id : 'dob'},
{label : 'ACTION',id : 'act'}]
,rows : ${loy.fssReg}}"/>
I only want to do this dynamically from the java class instead of on the jsp page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top