I'm using PrimeFaces 5.
I would like to open a dialog when a button is pressed.
<p:commandButton value="add upload" actionListener="#{theForm.openUpload}" >
public void openUpload() {
this.item = new Item();
RequestContext.getCurrentInstance().openDialog("uploadForm");
}
There will be a save button in the dialog to save the inputs.
<h:commandButton value="#{text['button.add']}" id="add" styleClass="btn btn-default" actionListener="#{theForm.confirmAdd}"/>
public void confirmAdd() {
RequestContext.getCurrentInstance().closeDialog("uploadForm");
}
My managed bean is @ViewScoped
. Will the command button break the view scope if the dialog is in an external file as done by PrimeFaces Dialog Framework? Whenever I click the "add upload" button, the @PostConstruct
method is called again just like the scope is lost.
Comments section of the official blog says it won't break the view scope, but here the forum a core developer says openDialog()
creates a new view, therefore it breaks the view scope.
Can someone confirm this?