Got the same problem here with CommandButtons. No ViewState is submitted after the first response. At the subsequent request it's there.
The problem here is that I used 2 different forms - putting the components into a single form will show the expected (correct) behaviour.
[b]index.xhtml[/b] (fails):
<html xmlns="
http://www.w3.org/1999/xhtml"
xmlns:h="
http://java.sun.com/jsf/html"
xmlns:f="
http://java.sun.com/jsf/core">
<h:body>
<h:head></h:head>
<h:form rendered="#{bean.value}" >
<h:panelGroup>
<h:commandButton value="Set False" action="#{bean.setFalse}" >
<f:ajax execute="@form" render="@all" />
</h:commandButton>
</h:panelGroup>
</h:form>
<h:form rendered="#{!bean.value}" >
<h:panelGroup>
<h:commandButton value="Set True" action="#{bean.setTrue}" >
<f:ajax execute="@form" render="@all" />
</h:commandButton>
</h:panelGroup>
</h:form>
</h:body>
</html>
[b]index.xhtml[/b] (ok):
<html xmlns="
http://www.w3.org/1999/xhtml"
xmlns:h="
http://java.sun.com/jsf/html"
xmlns:f="
http://java.sun.com/jsf/core">
<h:body>
<h:head></h:head>
<h:form>
<h:panelGroup rendered="#{bean.value}">
<h:commandButton value="Set False" action="#{bean.setFalse}" >
<f:ajax execute="@form" render="@all" />
</h:commandButton>
</h:panelGroup>
<h:panelGroup rendered="#{!bean.value}">
<h:commandButton value="Set True" action="#{bean.setTrue}" >
<f:ajax execute="@form" render="@all" />
</h:commandButton>
</h:panelGroup>
</h:form>
</h:body>
</html>
[b]Bean.java:[/b]
import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
@Named
@SessionScoped
public class Bean implements Serializable {
private boolean value;
public boolean isValue() {
return value;
}
public void setValue(boolean value) {
this.value = value;
}
public void setTrue() {
value = true;
}
public void setFalse() {
value = false;
}
}
[Message sent by forum member 'tij651']
http://forums.java.net/jive/thread.jspa?messageID=394032