I do the front end HTML for a JSF team. I often run into the JSF tags being used rendering HTML of their own. It’s often a SPAN and isn’t usually a problem, but once in a while we have this:
<table>
<h:panelGroup rendered="[jsf logic]">
<tr><td>#{jsfVariable}</td></tr>
</h:panelGroup>
</table>
Which will render this:
<table>
<span>
<tr><td>Hello World.</td></tr>
</span>
</table>
I’ve been reading through JSF tag documentation but can’t find a specific mention of a way to tell the JSF tag to only render the child HTML, not the tag itself as an HTML element. Is there a JSF attribute to tell it “don’t render a span”? Or is there a JSF tag that will not render as HTML, but still allow for use of JSF variables within?
The
<span>is only generated if you give the<h:panelGroup>an attribute which must end up in HTML, such asid,styleClass, etc. In your given example, the<h:panelGroup>has only arenderedattribute, so nothing will be generated to the HTML.So, to achieve your requirement, just remove all attributes other than
renderedfrom the<h:panelGroup>, exactly as you did in your own question example.