I’m wanted to use a panelGroup to group my inputs and their labels
e.g
<h:panelGroup styleClass="#{jsfServicesError.errorClass}" binding="#{jsfServicesError.myComponent}">
<h:outputLabel for="company" id="companyLabel" value="#{bundle.IDENTITY_COMPANY} * :"/>
<h:inputText id="company" label="#{bundle.IDENTITY_COMPANY}" value="#{manager.uiUser.attribute.company}" required="true" styleClass="text normal">
<f:validateLength minimum="3"/>
</h:inputText>
</h:panelGroup>
If I put some more other panelGroups after one I get as result 1 span class which includes all other inputs and labels. Is this working as intended?
I created an SSCCE with Mojarra 1.2_14 on Tomcat 6.0.20:
And the output is just as expected:
Your problem lies somewhere else. Maybe you actually didn’t look in the generated HTML output or you expected that the multiple panelgroups would be aligned under each other. If the latter is true, then you need to add
layout="block"to theh:panelGroupso that it will render a<div>instead. A HTML<div>element is by default a block element while the HTML<span>element is an inline element. Roughly said, HTML block elements like<form>,<div>,<table>,<ul>, etc implicitly adds a newline after so that any next element visually starts at a new line.If you’re still on the ancient JSF 1.1 or older where the
h:panelGroupdoesn’t have thelayoutattribute, then you’ll need to add CSSdisplay: blockto the class associated with the<span>element.