I use <h:outputLink> as follows.
<c:set var="cid" value="1"/> <c:set var="sid" value="2"/> <h:outputLink value="Test.jsf"> <h:outputText value="Link"/> <f:param name="cid" value="#{cid}"/> <f:param name="sid" value="#{sid}"/> </h:outputLink>
This is just an example. Both query string parameters are dynamic. So, <c:set> used here only for demonstration.
At any moment, either one, or both, or none of the parameters can be present. In the event that only one or none of them is present, the / s option is not necessarily added to the URL, which should not occur. Preventing the addition of unnecessary query string parameters to the URL requires conditional rendering of <f:param> .
JSTL <c:if> as below
<c:if test="${not empty cid}"> <f:param name="cid" value="#{cid}"/> </c:if>
does not work.
How can we conditionally render <f:param> inside <h:outputLink> ?
Tiny
source share