I have an import function which will parse the XML file which contains the version information of the document and save it in database. If user try to upload the already exi
You are facing in typical Primefaces Problem.
When your page is displayed and buttonBean.showConfirm = false, this element is not rendered. This means, it will not appear in the DOM-Tree. No matter what you do afterwards, a non existing element cannot be shown or hidden.
There are actually two ways to solve you problem.
I faced very similar question. The solution I came up with was to split the logic into 2 - first, when the button is pressed use 'action' to prepare the data for the validation and use 'oncomplete' to run a remote command which displays the confirmation dialog in which 'OK' is the real action.
Case
Validate that there is a selected item by pressing the Delete button. If you open a popup, if not shown in the error message, growl.
Alternative: (Sorry I had trouble posting the code)
XHTML: View xhtml
TestManageBean: Manage bean
MORE INFO: www.primefaces.org/showcase/ui/dialogLogin.jsf
It's not possible to get confirmation from the client during processing on server.
You have two options:
Get overwrite permission before calling your action method e.g. with a checkbox "Overwrite file if exists?" or
You have to stop processing, set a flag and return null to reload current page in browser.
Then you could display the p:dialog
depending on flag status.