3) Only populate your value objects with the required columns in the first place. A simple custom tag can be used to ignore it's body if an attribute is null.
-- Mike W > > >You have two choices. > >1) Use a simple Collection and test the values with many if statements. > This is the option you are using right now. > >2) Wrap the Collection in a custom object that contains the logic needed >to determine which values are appropriate. Then in your JSP you can >simply call a single polymorphic method, like "getPreferredColumns()", >which will return only the columns that the user wants. Or >"getColorizedColumns()", which will return all columns but with the >desired columns colorized. > >Either way, at some point you have to test the columns' values to see >which are appropriate for display/colorizing, but by doing it this way >you encapsulate that logic in one class rather than in a bunch of JSPs. > Even if I were only using this object in one JSP, I would still take >the second approach. > > >Erik > > > >Jayaraman Dorai wrote: >> Yes, doing the same thing. >> >> Some columns requires a different background color and most of >them have something different. So, it results in a lot of if >statements to check the column. >> >> Looking desperately for a good solution. >> >> Jayaraman >> -----Original Message----- >> From: Gandle, Panchasheel [mailto:[EMAIL PROTECTED] >> Sent: Monday, August 04, 2003 11:04 AM >> To: 'Struts Users Mailing List' >> Subject: RE: dynamic columns for a jsp >> >> >> We have a very similar situation, haven't done it yet, >> but planning to have two collection to iterate over. >> >> one for the columns, that I know when the user logs in, I would >get it from >> his preferences of columns from DB. >> other the business objects... >> >> is this the same that you are doing or any different? >> If somebody has a good solution for this, would help.... >> >> >> Panchasheel >> >> -----Original Message----- >> From: Jayaraman Dorai [mailto:[EMAIL PROTECTED] >> Sent: Monday, August 04, 2003 10:47 AM >> To: [EMAIL PROTECTED] >> Subject: dynamic columns for a jsp >> >> >> There are around 20 attributes for a business object. The jsp >iterates over >> a collections of this business object and displays them. The >user does not >> want to see all the 20 attributes. Different users may want to >see different >> attributes. This requirement is similar to what outlook >provides, the user >> can select the columns of his inbox. >> >> Have build a separate UI to get from the user the different >columns he wants >> to see and store them in the database. The jsp which iterates over the >> business object, looks untidy now, with a lot of if/else statements. >> >> If anyone else have designed something like this, please provide your >> suggestions. >> >> Thanks >> Jayaraman >> >> --------------------------------------------------------------------- >> 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]