INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

jmaki dojo table columns from java bean

jmaki dojo table columns from java bean

(OP)
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="http://jmaki/v1.0/jsp" %>
<%@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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close