My JSF backing bean is ViewScoped
.
Since I've added another action listener, the bean gets re-created even the view hasn't changed.
@ManagedBean (name="EncryptionBean")
@ViewScoped
public class EncryptionBean extends ClientBeanBase implements Serializable, ActionListener
{
.
.
.
@Override
public void processAction(ActionEvent arg0) throws AbortProcessingException
{
refresh();
}
}
HTML
<p:commandButton value="OK" type="submit" actionListener="#{FileSelectBean.actionOk}" oncomplete="dlgFileSelect.hide();" update=":formEncryptionDialog,:formTranscodingPage:streamInfoId" styleClass="buttonOK">
<f:actionListener type="com.company.rews.webclient.beans.EncryptionBean" />
</p:commandButton>
When I press OK
button, I wouldn't expect that the bean is created again since it is ViewScoped
, however it gets re-created (constructor called) and I loose some variables. When I remove the <f:actionListener>
line, the been is not re-created on OK
.
What should I do?