JSF2 ui: enable variable input parameter number

We have a common component where the number of buttons or checkbox changes, as well as labels. Can I have a common include and pass file that can change. In the include file there is a way to find how many input parameters and based on this displays so many buttons or checkboxes.

+3
source share
1 answer

You can use <ui:param>to pass parameters to the include file.

<ui:include src="/WEB-INF/includes/some.xhtml">
    <ui:param name="number" value="3" />
</ui:include>

The parameter value is in the example above, available as #{number}in some.xhtml.

An alternative is to register the include file as a tag file in the file .taglib.xml:

<tag>
    <tag-name>some</tag-name>
    <source>/WEB-INF/tags/some.xhtml</source>
</tag>

Then you can specify the parameter as an attribute of the tag file:

<my:some number="3" />

#{number} some.xhtml.

+5

All Articles