Hi guys, So I have alot of stuff in my apps where I am making a table of records on a JSP page. You know almost like a report or a list and then user can click something and go somewhere else. What I run into alot is that when you're doing names and address that often you'll have fields which a generally blank for most users, like Second Line Address and such. So for those I usally have to do 2 logic tags to put a in the final table, because I use alot of table borders. Is there an easier way to do it, so that I get nice full looking tables, and just blank spots for the empty fields?
Well, you can do what you've already figured out--use a logic tag. Or you can do like I did and write your own extensive custom tag library for handling tables. Actually, I'm in the process of looking into submitting it to Apache for inclusion in the HTML taglib. If there's anyone here from the Struts committers list that's interested, drop me a line!
"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
I've put a re-packaged version on my personal site at http://www.coruscant.cc/Struts/tables.jar There are a few things that I know need done--i18n capabilities for one--but I think they're quite useful. Esp the fact that the table row highlighting will take care of itself, as long as you declare the style classes on the table accordingly. Comments are welcomed, esp from Struts committers...
That's pretty cool. Many nice features--esp the paging and export--but there are some capabilities missing that I particularly like. a) the style classes are set in the code b) You can't mix these with other table components if parts of your table are static c) sorting is only done per-page There's also a bug reported in that you can't put more than one of the tables on a page, but based on what I saw in the examples this is only a problem if you want to use the paging feature. Nonetheless, it's cool enough that I hooked to their CVS repository on SourceForge. Who knows--I may even end up contributing.
Joined: Oct 10, 2002
Thanks David, I agree it's a neat TagLib. I am highly considering using it. It has alot of good built in features. But I think in another 6 months if work continues, it would be mature enough for production use.