What jsf component can render a div tag?

JsfHtml

Jsf Problem Overview


Eg: h:inputText will render a "input type='text'". What jsf tag can render a "div" tag?

Jsf Solutions


Solution 1 - Jsf

You can create a DIV component using the <h:panelGroup/>. By default, the <h:panelGroup/> will generate a SPAN in the HTML code.

However, if you specify layout="block", then the component will be a DIV in the generated HTML code.

<h:panelGroup layout="block"/>

Solution 2 - Jsf

In JSF 2.2 it's possible to use passthrough elements:

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:jsf="http://xmlns.jcp.org/jsf">
    ...
    <div jsf:id="id1" />
    ...
</html>

The requirement is to have at least one attribute in the element using jsf namespace.

Solution 3 - Jsf

Apart from the <h:panelGroup> component (which comes as a bit of a surprise to me), you could use a <f:verbatim> tag with the escape parameter set to false to generate any mark-up you want. For example:

<f:verbatim escape="true">
    <div id="blah"></div>
</f:verbatim>

Bear in mind it's a little less elegant than the panelGroup solution, as you have to generate this for both the start and end tags if you want to wrap any of your JSF code with the div tag.

Alternatively, all the major UI Frameworks have a div component tag, or you could write your own.

Solution 4 - Jsf

Solution 5 - Jsf

I think we can you use verbatim tag, as in this tag we use any of the HTML tags

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser101442View Question on Stackoverflow
Solution 1 - JsfRomain LinsolasView Answer on Stackoverflow
Solution 2 - Jsfmp31415View Answer on Stackoverflow
Solution 3 - JsfNick GrubbView Answer on Stackoverflow
Solution 4 - Jsfjack jinView Answer on Stackoverflow
Solution 5 - JsfSanketView Answer on Stackoverflow