as the question above mentiones, i need to create "dynamic" params for a
<ui:composition>
<h:link>
<h:outputText value="link with params" />
<ui:repeat var="parameter" value="#{bean.getCurrentParameter}"> //customClass
test: #{parameter.name} #{parameter.value} //output is fine
<f:param name="#{parameter.name}" value="#{parameter.value}" />
</ui:repeat>
</h:link>
</ui:composition>
unfortunately the "test" returns all values correctly, but when I hover the link, there is not a single parameter set ("page.xhtml" instead of "page.xhtml?param1=ddd¶m2=sss...")
To unterstand why I need this, I want to get all parameters of the current page and add/remove one (the link clicked on is the one I want to remove/add).
to I need to generate for each link its own parameters (when param1=1,2 by default, one link has e.g. "param1=1,2,3" (appends 3) and the other one has "param1=1,2,4" (appends 4))
Classic taghandlers vs component tags issue. <ui:repeat/>
is a component tag that runs after the view tree has been built while <f:param/>
is a tag handler that is placed in the view tree during view build. What this means is that <f:param/>
is parsed and processed before <ui:repeat/>
ever makes it into the page. As a result var="parameter"
is not available for use when <f:param/>
needs it.
To fix, use the <c:forEach/>
tag instead:
<h:link>
<h:outputText value="link with params" />
<c:forEach var="parameter" items="#{bean.getCurrentParameter}">
test: #{parameter.name} #{parameter.value}
<f:param name="#{parameter.name}" value="#{parameter.value}" />
</c:forEach>
</h:link>