wood burning stoves 2.0*
The moose likes Struts and the fly likes How does everyone else handle table entries and null values? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How does everyone else handle table entries and null values?" Watch "How does everyone else handle table entries and null values?" New topic
Author

How does everyone else handle table entries and null values?

Paul Duer
Ranch Hand

Joined: Oct 10, 2002
Posts: 98
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?
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
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.
Sven Bell
Greenhorn

Joined: Feb 11, 2003
Posts: 7
What about using a <logic resent> tag, it is null, you can check with <logic:notPresent> and what I do is insert a   if it is not present to keep the tables looking good.
Paul Duer
Ranch Hand

Joined: Oct 10, 2002
Posts: 98
David, I think we'd all like to see the custom tag library you've made, specially if you're going to submit it!
Or email me at paul.duer@haverstickconsulting.com
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
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...
Hung Tang
Ranch Hand

Joined: Feb 14, 2002
Posts: 148
You might want to give this a look:
http://edhill.its.uiowa.edu/display/
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
Originally posted by Hung Tang:
You might want to give this a look:
http://edhill.its.uiowa.edu/display/

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.
Paul Duer
Ranch Hand

Joined: Oct 10, 2002
Posts: 98
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How does everyone else handle table entries and null values?
 
Similar Threads
Contents of one form on another one.
@Embedded not loading with owner entity
about null fields in a table
Performance with Hibernate
JPA mapping/ERD advice