Re: [displaytag-user] Dynamic Column Creation
Brought to you by:
fgiust
From: jill j. <jil...@gm...> - 2007-04-24 13:45:55
|
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=3D"bean2" > <display:column property=3D"name" title=3D"School Name" ></display:colu= mn> <c:forEach var=3D"cl" items=3D"bean2.bean1"> <display:column title=3D"${cl.title}" property=3D"${cl.value}" /> </c:forEach> <display:column property=3D"allocatedAmt" format=3D"{0,number,0,000.00}= $" title=3D"Total Allocated $" ></display:column> <display:column property=3D"totalOfAllPrograms" format=3D"{0,number,0,0= 00.00} $" title=3D"Current Total $" ></display:column> <display:column property=3D"difference" format=3D"{0,number,0,000.00} $= " title=3D"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=EDn Santos <gad...@ho...> 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 tha= t > 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=3D"radioButton" > > <display:table name=3D"table" class=3D"displaytag" > decorator=3D"es.dap.ecsi.displaytag.decorator.ExpedienteDecorator"> > <display:column style=3D"width=3D4%;" media=3D"html" > property=3D"radioButton" title=3D"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=3D (ExpedienteView)getCurrentRowObject(); > int campagna =3D row.getCampagna(); > int expediente =3D row.getExpediente(); > String control =3D row.getControl(); > > String result =3D "<input type=3D\"radio\" name=3D\"radio\" > id=3D\""+expediente+"\" onclick=3D\"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" <jil...@gm...> > >Reply-To: dis...@li... > >To: dis...@li... > >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 > >dis...@li... > >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 > dis...@li... > https://lists.sourceforge.net/lists/listinfo/displaytag-user > |