File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Advice on use of h:panelgrid vs. html tables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Advice on use of h:panelgrid vs. html tables" Watch "Advice on use of h:panelgrid vs. html tables" New topic

Advice on use of h:panelgrid vs. html tables

ed connell

Joined: Oct 26, 2009
Posts: 14
If I were just using JSF, and not a nice component library like RichFaces, there's obviously quite a lack of control with the panelgrid component.

I believe I saw mention on this forum somewhere, think it was Tim H, to just use html tables to gain control of the formatting.

I just started to experiment, and it seems to be what I should've done from the start, rather than try and shoe horn everything into panelgroups and panelgrids.

So, would this be considered common place to just use the html markup, peppered with JSF tags? Any pitfalls I'm likely to run into before I go too far down this road?

Rainer Eschen
Ranch Hand

Joined: Jan 24, 2009
Posts: 75
We had the same problem using early releases of ICEfaces some years ago. It was a good idea to use pure HTML tables those days.

Meanwhile I tried a cleaner implementation with my ICEfaces book code. Today I would suggest to use panelGrid and panelGroup. This will help for maintenance. Our "old code" is full of HTML table tags and a bit too unclear. You already notice smells even after about 1-2 years.

ICEfaces book . ICEcube . ICEfusion . Scrum
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

Actually, I've changed my mind in recent times, myself. Although the lack of rowspan and colspan in the core datagrid components is a royal nuisance, overall I've found that the page is cleaner using pure JSF instead of HTML. Plus, of course, removing raw HTML gives more options for alternative rendering systems.

I just got done removing one of my last HTML holdouts just the other day.

An IDE is no substitute for an Intelligent Developer.
ed connell

Joined: Oct 26, 2009
Posts: 14
Many thanks to you both - I'll discard that line of thinking then and plow ahead with styling up my panelgroups and grids.

I must admit-my little experiement at resorting back to html markup was making the code look just downright ugly.

suresh dasari
Ranch Hand

Joined: Oct 05, 2009
Posts: 121

I agree that panelgrids doesnt support colspan, but you can extend the existing panelgrid and create a custom one with colspan and use instead.

Sun Certified Java Programmer with 93 percent
I agree. Here's the link:
subject: Advice on use of h:panelgrid vs. html tables
jQuery in Action, 3rd edition