I build a simple page that acts as insert and edit:
<f:metadata>
<f:viewParam name="id" value="#{bean.id}" />
<f:viewAction action="#{bean.init}" />
</f:metadata>
...............
<h:form>
...........
<h:commandLink action="#{bean.update}" rendered="#{not empty bean.id}">
<f:ajax execute="@form" render="@form" />
Update <i class="fa fa-check"></i>
</h:commandLink>
<h:commandLink action="#{bean.save}" rendered="#{empty bean.id}">
<f:ajax execute="@form" render="@form" />
Save <i class="fa fa-check"></i>
</h:commandLink>
</h:form>
So the page checks if it get id
parameter in the url, it so, create "update" link, otherwise "save" link.
The rendered attribute works fine, but the update link doesn't sends the ajax request, but the save link works fine.
When I remove rendered
attribute, both works just fine! So why the update link not working if the rendered
attribute exists?