I encountered some problem creating a reusable button, trying to dynamically add one or more f:param within the h:commandButton tag. I don’t know what I’m missing, btw I’m using the 2.1 version.
I found out that this can be made by a backing bean somehow, but I’m not using one just for this component, instead the one I’m using refers to the page (and many others that are under the same directory), thus I can’t add a var inside it (if it’s right what I’m telling) just for the following use case.
Since I have another implementation without the composite component, and the behaviour it’s not the same, I would like to understand what I’m missing or doing wrong.
USAGE:
<component:button additionalParams="#{{'key':'value'}}"/>
DEFINITION:
<cc:attribute name="additionalParams" type="java.util.Map" required="false"/>
IMPLEMENTATION:
<h:commandButton {...other attributes}>
<h:panelGroup rendered="#{additionalParams != null and not empty ...}">
<c:forEach var="param" items="#{cc.attrs.additionalParams.entrySet()}">
<f:param name="#{param.key}" value="#{param.value}"/>
</c:forEach>
</h:panelGroup>
</h:commandButton>
Pablo Escobarl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.