JSP - Dynamic Table Data

Hi all.

I have this problem for some time now. I need to show data as soon as I retrieve it from database. The code I'm using is as follows:

privateboolean constructUiDynamically(){

Table table=null;

TableRowGroup rowGroup=null;

TableColumn tableColumn1=null; String column1Header ="ISSUER ID";

Label aLabel=new Label(); aLabel.setVisible(true);

aLabel.setStyle("heigth: 100%; width: 100%");

TableColumn tableColumn2=null; String column2Header ="ISSUER BIN";

TextField aTextField =new TextField(); aTextField.setVisible(true);

aTextField.setStyle("heigth: 100%; width: 100%");

IssuerTableDataProvider itdp =null;

Button commitButton =null;

Button undoButton=null;

Bankbank=null;

String bid=null;

String bname=null;

Vector issuers=null;

String iid=null;

String ibins=null;

String tableTitle =null;

int numOfIssuers = -1;

int numOfBanks= this.bankInstances.size();

for(int i=0; i<numOfBanks; i++){

// data

bank = (Bank) this.bankInstances.elementAt(i);

bid = bank.getBankId();

bname = bank.getBankName();

issuers = bank.getVIssuers();

// objects

table=new Table(); table.setTitle("Bank ID: " + bid +" Bank Name: " + bname); table.setVisible(true);

rowGroup=new TableRowGroup(); rowGroup.setVisible(true);

tableColumn1 =new TableColumn();tableColumn1.setHeaderText(column1Header);tableColumn1.setVisible(true);

tableColumn1.setStyle("height: 20px; width: 3px");

tableColumn2 =new TableColumn();tableColumn2.setHeaderText(column2Header);tableColumn2.setVisible(true);

tableColumn2.setStyle("height: 20px; width: 150px");

commitButton =new Button();commitButton.setText("Commit");commitButton.setVisible(true);

undoButton=new Button();undoButton.setText("Undo"); undoButton.setVisible(true);

// connect objects

rowGroup.getChildren().add(tableColumn1);

rowGroup.getChildren().add(tableColumn2);

table.getChildren().add(rowGroup);

tableColumn1.getChildren().add(aLabel);

tableColumn2.getChildren().add(aTextField);

this.getLayoutPanel1().getChildren().add(table);

this.getLayoutPanel1().getChildren().add(commitButton);

this.getLayoutPanel1().getChildren().add(undoButton);

this.getVColumn1().add(tableColumn1);

this.getVColumn2().add(tableColumn2);

this.getVRowGroups().add(rowGroup);

this.getVDataProvider().add(itdp);

this.getVTable().add(table);

this.getVCommitButtons().add(commitButton);

this.getVUndoButtons().add(undoButton);

// data provider fill up

numOfIssuers = issuers.size();

itdp =new IssuerTableDataProvider(numOfIssuers);

for(int j=0; j><numOfIssuers; j++){

iid= ((Issuer) issuers.elementAt(j)).getISSUER_ID();

ibins = ((Issuer) issuers.elementAt(j)).getLineOfBins();

itdp.setValue(j, iid, ibins);

}

rowGroup.setSourceData(itdp);

}

returntrue;

}

My data source object is a custom class that extends the ObjectArrayDataProvider. Everything seems to work perfectly except that no data are shown in the table. If I use my data source to manually request the data every thing is ok, but no data actually are printed in the table.

First of all, can I do this, or I must follow another approach?

Any help, please?>

[5361 byte] By [n.vasilia] at [2007-11-27 4:24:30]
# 1
Are you talking about JSF? If so, which implemention?
BalusCa at 2007-7-12 9:32:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I'm using JSF 1.1.

Classes I currently use are these:

import com.sun.rave.web.ui.component.Body;

import com.sun.rave.web.ui.component.Button;

import com.sun.rave.web.ui.component.Form;

import com.sun.rave.web.ui.component.Head;

import com.sun.rave.web.ui.component.Html;

import com.sun.rave.web.ui.component.Label;

import com.sun.rave.web.ui.component.Link;

import com.sun.rave.web.ui.component.Page;

import com.sun.rave.web.ui.component.PanelLayout;

import com.sun.rave.web.ui.component.StaticText;

import com.sun.rave.web.ui.component.Table;

import com.sun.rave.web.ui.component.TableColumn;

import com.sun.rave.web.ui.component.TableRowGroup;

import com.sun.rave.web.ui.component.TextField;

The project is built by the netbeans IDE using the web visual plugin and other tools provided by that IDE.

n.vasilia at 2007-7-12 9:32:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

For JSF there is actually another subforum: http://forum.java.sun.com/forum.jspa?forumID=427

I am sorry to say that I can't help you further in detail. I don't know those com.sun.rave.web.ui components. But I can tell that in the basic Sun JSF RI implementation you have to define values as valuebindings to a managed bean, not as actual values.

BalusCa at 2007-7-12 9:32:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...