tags:

views:

183

answers:

2

Hello,

Suppose I want display table:

+--------------------------------+
|        |           |           |
----------------------------------
|                    |           |
----------------------------------
|        |                       |
----------------------------------
|        |           |           |
----------------------------------
|        |           |           |
+--------------------------------+

How can I do that with h:panelGrid?

+2  A: 

You can't do this with the standard JSF implementation. In JSF 1.2 one would have used Tomahawk's <t:panelGroup colspan="2"> for this. Right now Tomahawk is not officially compatible with JSF 2.0, but I just gave it a try.

<html xmlns:t="http://myfaces.apache.org/tomahawk"&gt;
...
<t:panelGrid columns="3">
    <t:panelGroup>row1cell1</t:panelGroup>
    <t:panelGroup>row1cell2</t:panelGroup>
    <t:panelGroup>row1cell3</t:panelGroup>

    <t:panelGroup colspan="2">row2cell1-2</t:panelGroup>
    <t:panelGroup>row2cell3</t:panelGroup>

    <t:panelGroup>row3cell1</t:panelGroup>
    <t:panelGroup colspan="2">row3cell2-3</t:panelGroup>

    <t:panelGroup>row4cell1</t:panelGroup>
    <t:panelGroup>row4cell2</t:panelGroup>
    <t:panelGroup>row4cell3</t:panelGroup>
</t:panelGrid>

And it works. I don't guarantee that other Tomahawk components will work as well.

BalusC
+1  A: 

I don't think core JSF supports this, but some 3rd-party implementations might. Someone posted a solution to this using Tomahawk at the end of the post at the following URL:

http://www.coderanch.com/t/211242/JSF/java/colspan

Jim Tough