I have a .xhtml with two commandlink buttons and two outputpanels. Everything inside same form. When I click on commandlink why do I need to explicitly say which output panels need to be rendered? If nothing specified, shouldn’t entire view re-constructed based on following description from Spec (or) Am I mixing things?
As well as do we really need to set action="navigation-rule" when we want to refresh a component in same view?
Link controls are typically used to perform complete form submissions for data storing.
As a consequence, the <a4j:commandLink> component has the execute="@form" setting by default.
Any input is much appreciated.
Here is code for reference:
<h:form>
<div>
<a4j:outputPanel layout="block">
<!--Tab1 -->
<a4j:commandLink
id="homeTabLinkId"
value="Tab1"
actionListener="somelistener" render="contentDIVId">
<h:outputText value=""/>
</a4j:commandLink>
<!--Hosts Tab -->
<a4j:commandLink
id="hostsTabLinkId"
value="Tab2"
actionListener="anotherlistener" render="contentDIVId">
<h:outputText value=""/>
</a4j:commandLink>
</a4j:outputPanel>
</div>
<a4j:outputPanel layout="block" id="contentDIVId">
<!-- dynamically gets src based on tab click -->
<ui:include id="tabBodyPanel" src="elexpression"/>
</a4j:outputPanel>
<a4j:outputPanel layout="block" id="anotherdiv">
<h:outputText value="Inside second div"/>
</a4j:outputPanel>
</h:form>
That applies only to synchronous requests. Replace
<a4j:commandLink>by<h:commandLink>and you’ll get the described behaviour.No. The action method can just return
nullorvoid. Otherwise the view will be recreated and that isn’t what you want if you’ve view scoped beans on the view.