Hello Andreas:

this is the java code that generate the List:

try
{
        try
        {                       
                rs = pstmt.executeQuery();
                NumColumnas = 0;
                rsMeta = rs.getMetaData();
                NumColumnas = rsMeta.getColumnCount();
        }
        catch (SQLException ex){
                logger.error(ex.getMessage());
...
                throw (ex);
        }
        rs.next();
        lstResultado = Collections.synchronizedList(new ArrayList());
        Object[] lstRow = new Object[NumColumnas];
        while (!rs.isAfterLast()){
                for (i=0;i<NumColumnas;i++){
                         lstRow[i] = rs.getObject(i+1);
                }
                lstResultado.add(lstRow);
                rs.next();
        }
        rs.close();
}

lstResultado is the List of Object[] and with the debugger I see that the number of rows is correct (and the paging in the html result)


This is the relevant part of my listener (the listener for searching)


Object[] actRow = new Object[numColumns];
for (t = 0; t < resultado.size(); t++){ //Resultado is the same as lstResultado
        u=0;
        for (i=0;i<camposTabla.size();i++){
                if (((TCampo)camposTabla.get(i)).isVisible()){ //Only visible 
fields
actRow[u]=((Object[])resultado.get(t))[i].toString(); //with or without .toString is the same result
                u++;
                }
        }
        result.add(actRow);                     
}
setResultDatos(result); //This set the data to see


and the relevant .html is

            <table class="mytable" jwcid="[EMAIL PROTECTED]:Table"
              source="ognl:resultDatos"
              columns="ognl:listCamposUser">

listCamposUser returns what you suggest as the HTML resulted

<tr>
<td class="[0]ColumnValue"></td>
<td class="[1]ColumnValue"></td>
<td class="[2]ColumnValue"></td>
<td class="[3]ColumnValue"></td>
<td class="[4]ColumnValue"></td>
<td class="[5]ColumnValue"></td>
<td class="[6]ColumnValue"></td>
</tr>

with this information, what do you think I'm missing or overlooked?


Thanks

JQ


Andreas Andreou escribió:
What exactly are the objects of your list?
[0] calls toString() on the first item and prints it.
Perhaps you want to try
[0].getName() or something...

Jorge Quiroga wrote:

Hi Andreas:

I done what you recommend, with source (the List of
Object[NumColumns]) and columns parameters (as you said), the
pagination links appear but no data is showed. I don´t know if the
List cannot contain an array for each row and should be the data
directly with the corresponding type as in the examples. I'm missing
something?

Thanks

Andreas Andreou escribió:

use
columns="[0], [1], [2]",
or if number of columns is unknown, build it at runtime:
columns="ognl:funnyColumns"

// colNum is number of columns
public String getFunnyColumns()
{
  StringBuffer sb = new StringBuffer(colNum*5);
  for (int i=0; i<colNum; i++)
  {
    if (i!=0)
      sb.append(", ");

    sb.append("[").append(i).append("]");
  }
  return sb.toString();
}

Jorge Quiroga wrote:

Hi Folks:

I'm trying to put information extracted from a DB into contrib:Table
unsuccessfully, because the query is generated dynamically. The Query
works, and return an ArrayList composed by Object[], each Object[]
represents a row and the output is the pointer not the data inside.
The problem is that I cannot found an example with these
characteristics, always is a List with known number of columns, and
known data type. Someone has an example were I can see how to show
results got from a dynamically generated query or what alternatives I
have to show this information in a Tapestry way, preferably using
contrib:Table?


Thanks in advance

Jorge


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
 Ing. Jorge Enrique Quiroga
Analista programador
PCT LTDA

Teléfonos: 4800069-4800046-4811984
Dirección: Carrera 28 bis Nº 51-08
Bogota D.C. - Colombia


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to