i repost the answer of partlov becaus have some error and i corect this errors an put in this pos, and congratulatiosn partlov to much good answer
i complement your answer
first this is a xhtml page whith prime faces, if you want use a p: add this frameworc or an other.
if you wont download this framewor doenload hereDownload prime Framework for JSF
and impor for this way
xmlns:p="http://primefaces.org/ui"
select.XHTML
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:form>
<p:commandButton value="Add" update="panel">
<f:setPropertyActionListener value="add" target="#{myBean.action}"/>
</p:commandButton>
<p:commandButton value="Update" update="panel">
<f:setPropertyActionListener value="update" target="#{myBean.action}"/>
</p:commandButton>
<h:panelGroup id="panel">
<h:panelGroup rendered="#{myBean.action == 'add'}">
<ui:include src="headerLogin.xhtml"/>
</h:panelGroup>
<h:panelGroup rendered="#{myBean.action == 'update'}">
<ui:include src="Pajax.xhtml"/>
</h:panelGroup>
</h:panelGroup>
</h:form>
</h:body>
nex step is a create a clas myBean and use this string for a select whath UI you want render
myBean.java
use this imports in a bean
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
and use this cod in a clas
public class myBean {
String action;
public void setAction(String action) {
this.action = action;
}
public String getAction() {
return action;
}
}
but remember put this line up to a class
@ManagedBean
@SessionScoped