Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tag for HTML table

 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I just browsed through the list of JSTL tags.
I was bit surprised that I did not see any tag for dynamic HTML table creation.
This is a common requirement for many project for example displaying account transaction.
How come JSTL missed this important tag?
 
Shawn Bayern
Author
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
Hi,
I just browsed through the list of JSTL tags.
I was bit surprised that I did not see any tag for dynamic HTML table creation.
This is a common requirement for many project for example displaying account transaction.
How come JSTL missed this important tag?

JSTL is intentionally not HTML-specific. There's really no way to write a generic <table> tag that would be useful in most applications. Instead, you typically build a table up through iteration:

What more would you like? If you suggest a specific alternative, I can probably explain why JSTL didn't include it. There's little way you'd be able to construct a table as generally as with <c:forEach> using some more limited construct -- but I'd be curious to know what you're thinking anyway.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I was just wondering if it possible to display tables using a single tag..may be we will be passing the column values of the table and other things like color, size etc as attributes..
But ur code looks fine to me. I agree with U -It is difficult to build a generic tag for displaying table tag. It will no doubt be a quite complicated stuff.
Thanks for clearing my doubt.
 
Shawn Bayern
Author
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
Hi,
I was just wondering if it possible to display tables using a single tag..may be we will be passing the column values of the table and other things like color, size etc as attributes..
But ur code looks fine to me. I agree with U -It is difficult to build a generic tag for displaying table tag. It will no doubt be a quite complicated stuff.
Thanks for clearing my doubt.

Indeed - more specifically, things like color and size are a function of the presentation tier, not the back-end. In JSP 2.0, if you find yourself using a particular pattern of JSTL tags frequently, you can write a JSP page that becomes its own new tag. (That's a little subtle, so if it seems confusing, don't worry about it for now -- it's just a feature in the future.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic