I am sorry, I think I conveyed my need differently. I do not need a
decorator.

My need is to create columns from database.

My need is 4 static columns but rest all columns coming fro database.

So I have build 2 beans for that.
bean1 -- name, value from database.

Bean 2 - 4 static columns + arraylist of bean1
in request i store arraylist of bean2.

my jsp code is this


<display:table name="bean2" >
  <display:column property="name"  title="School Name" ></display:column>

   <c:forEach var="cl" items="bean2.bean1">
     <display:column title="${cl.title}" property="${cl.value}"  />
   </c:forEach>

  <display:column property="allocatedAmt"  format="{0,number,0,000.00} $"
title="Total Allocated $" ></display:column>
  <display:column property="totalOfAllPrograms"  format="{0,number,0,000.00}
$" title="Current Total $" ></display:column>
  <display:column property="difference"  format="{0,number,0,000.00} $"
title="Difference" ></display:column>
</display:table>





But with below code i get following error

Error looking up property "${cl.currYearExpenditure}" in object type bean2

So it is not gonig to bean1. it is looking for the object in bean2.



Any help will be appreciated.



Thanks and regards,

Jill.








On 4/24/07, Felipe Martín Santos <[EMAIL PROTECTED]> wrote:

Have you tried to use a Decorator?

It's very simple, eg:

1) You must to use the atribute decorator in a column, whit the class that
do the decoration: in my example is ExpedienteDecorator. In this class
you've differents methods, and you use them like a property in the colum,
eg, property="radioButton"

<display:table  name="table" class="displaytag"
decorator="es.dap.ecsi.displaytag.decorator.ExpedienteDecorator">
       <display:column style="width=4%;" media="html"
property="radioButton" title="SELECCIONAR PARA VER
CONTROL"></display:column>

2) In the Decorator class I've the method radioButton, that returns and
String whit code html generate dinamycally with a radio button that has a
javascript method with differents parameters for each row.

public String getRadioButton() {
              //ExpedienteView  is the actual table type, and you can
access to each row with getCurrentRowObject and after accest to their
fields
with the accessors methods.

       ExpedienteView row= (ExpedienteView)getCurrentRowObject();
       int campagna = row.getCampagna();
       int expediente = row.getExpediente();
       String control = row.getControl();

       String result = "<input type=\"radio\" name=\"radio\"
id=\""+expediente+"\" onclick=\"actualizaDetalle("+expediente+");
parametrosExpedientes("+campagna+","+expediente+");\" />";
       return result;
}

I hope that you had understood my explanation, sorry for my english.
In the next link you can find more information:
http://displaytag.sourceforge.net/11/tut_decorators.html

Good luck!!

>From: "jill juneja" <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: [displaytag-user] Dynamic Column Creation
>Date: Mon, 23 Apr 2007 16:51:56 -0400
>
>I need to create dynamic columns in display tag. My need is i have 4
static
>columns and rest are dynamic columns. I have tried many options but
>nothing is working. Is this doable using display tag.
>Currently I have desgined bean as
>
>Bean1
>
>col1
>col2
>col3
>col4
>Arraylist of bean2
>
>Bean2
>colname
>colvalue
>
>Thanks and Regards,
>Jill


>-------------------------------------------------------------------------
>This SF.net email is sponsored by DB2 Express
>Download DB2 Express C - the FREE version of DB2 express and take
>control of your XML. No limits. Just data. Click to get it now.
>http://sourceforge.net/powerbar/db2/


>_______________________________________________
>displaytag-user mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/displaytag-user

_________________________________________________________________
Dale rienda suelta a tu tiempo libre. Mil ideas para exprimir tu ocio con
MSN Entretenimiento. http://entretenimiento.msn.es/


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to