I have the following scenario:
A web application (JSF) using the HttpSession provided by Spring Session (redis), this web application uses Myfaces and primefaces.
Consider this page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<f:view transient="true">
<h:head>
</h:head>
<h:body>
<h:form>
<p:commandLink actionListener="#{mainMB.enableButton}" update="pnl1" value="Click to render button" />
<h:panelGroup id="pnl1" layout="block">
<p:commandButton value="not working" actionListener="#{mainMB.process}"
oncomplete="PF('dlgNome').show();" rendered="#{mainMB.shouldRenderButton}"/>
</h:panelGroup>
<h:panelGroup id="pnl2" layout="block">
<p:commandButton value="working" actionListener="#{mainMB.process}"
update="dlgNome" oncomplete="PF('dlgNome').show();" />
</h:panelGroup>
<p:dialog id="dlgNome" widgetVar="dlgNome" header="Nome">
<h:panelGroup id="pnlNome">
<h:outputText value="#{mainMB.nome}" />
</h:panelGroup>
</p:dialog>
</h:form>
</h:body>
</f:view>
</html>
If I click the button with value "Button always rendered", everything goes fine. If I click the button with value "Click to render button", the second button with value "Button ajax rendered" is rendered, but, if I try to click the new button, then the dialog is show with no data inside.
I think that this is some kind of incompatibility between primefaces and Spring Session, because when I remove the spring session everything goes fine.
Thanks in advance.
MyFaces: 2.2.12
Spring: 4.3.7.RELEASE
Spring Session: 1.3.0.RELEASE
Spring Session (data - redis): 1.3.0.RELEASE
Lettuce: 3.5.0.Final
Primefaces: 6.0
There is a repo in my github with all code used (https://github.com/joaocarlos86/spring-session-problem)
MainMB
package br.com.jsf;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
@ManagedBean
@ViewScoped
public class MainMB implements Serializable{
private static final long serialVersionUID = -637131500663021232L;
private String nome;
private Boolean shouldRenderButton;
public void process(){
this.setNome("This is a name, and this is a number: ".concat(String.valueOf(Math.random())));
}
public void enableButton(){
this.shouldRenderButton = Boolean.TRUE;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public Boolean getShouldRenderButton() {
return shouldRenderButton;
}
public void setShouldRenderButton(Boolean shouldRenderButton) {
this.shouldRenderButton = shouldRenderButton;
}
}