Here is code:
<ui:repeat var="entity" varStatus="status" value="#{myentityListView.someList}">
<h:form>
<h:commandLink value="Go!" action="mypage.xhtml" >
<c:if test="#{entity.entityType=='Comment'}"><f:param name="productId" value="#{entity.product.getId()}"/></c:if>
<f:param name="userId" value="#{entity.user.getId()}"/>
</h:commandLink>
</h:form>
</ui:repeat>
Maybe its cause is that h:commandLink is in ui:repeat.
mypage.xhtml is an exixting page.
Thanks
You need to make sure that
#{myentityListView.someList}returns exactly the same value during the form submit request as it was during the request of displaying the page. Putting the bean in the view scope (just mark it@ViewScoped) and ensuring that you preserve the list during (post)constructor or in an action method should fix it.See also:
However, in your particular case, it’s much better to just use
<h:link>instead as you don’t seem to need to send a POST request at all. This way you end up with nice bookmarkable and searchbot-chipherable links.Also note that I fixed your
<c:if>approach by removing it as it won’t work as you’d expect. It would always evaluatefalse. See also JSTL in JSF2 Facelets… makes sense?See also: