Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add an empty element in a JSF panelGrid?

How do I add an empty element in a JSF panelGrid?

This is my full table:

<h:panelGrid columns="2">
    <h:outputLabel value="row1"/>
    <h:outputLabel value="row2"/>

    <h:outputLabel value="row1"/>
    <h:outputLabel value="row2"/>

    <h:outputLabel value="row1"/>
    <h:outputLabel value="row2"/>
</h:panelGrid>

How do I add an empty element? What is the advised way? (adding an empty outputlabel? This does not feel correct.)

<h:panelGrid columns="2">
    <h:outputLabel value="row1"/>
    <h:outputLabel value="row2"/>

    <!-- This need to be emtpy -->
    <h:outputLabel value="row2"/>

    <h:outputLabel value="row1"/>
    <h:outputLabel value="row2"/>
</h:panelGrid>
like image 659
Dimitri Dewaele Avatar asked Feb 19 '15 16:02

Dimitri Dewaele


People also ask

What is panelGrid in JSF?

In JSF , “h:panelGrid” tag is used to generate HTML table tags to place JSF components in rows and columns layout, from left to right, top to bottom.

What is panel grid?

PanelGrid is an extension to the standard panelGrid with theme integration, grouping and responsive features.


1 Answers

Use an empty <h:panelGroup>.

<h:panelGrid columns="2">
    <h:outputLabel value="row1"/>
    <h:outputLabel value="row2"/>

    <h:panelGroup />
    <h:outputLabel value="row2"/>

    <h:outputLabel value="row1"/>
    <h:outputLabel value="row2"/>
</h:panelGrid>

See also:

  • Java EE tutorial - <h:panelGrid>

Unrelated to the concrete problem, are you in basic HTML terms very well aware of when you should be using <h:outputLabel> instead of <h:outputText>? If not, carefully read Purpose of the h:outputLabel and its "for" attribute.

like image 65
BalusC Avatar answered Oct 05 '22 07:10

BalusC