Conditionally Dialog close

UI Components for JSF
Post Reply
unixlibre
Posts: 7
Joined: 31 Dec 2010, 03:14

31 Dec 2010, 03:31

Hi,

I'm new to PrimeFaces (coming from IceFaces). I just need a little orientation.

I'm using PrimeFaces 2.2-RC2, Mojarra 2.0.3, EJB 3.1, Glassfish 3.1 and NetBeans 6.9. I have a <p:dialog> with a simple form inside. The data entered are used to add customers to a database. Inside the dialog there is a

<p:commandButton id="btnSaveId" actionListener="#{...}"
onsucess="dlg.hide()" ... />

When the user adds a new customer sucessfully, the dialog hides away as expected. Now, I wonder how can I prevent the dialog closing in case of a problem when executing the actionListener handler. I.e, if the user tries to add a customer that already exists in the database, I catch an exception from the EJB layer and insert a FacesMessage to be shown in a p:messages, but how can I prevent the invocation of "dlg.hide()" (closing the dialog)?

Thank you in advance.
Antonio.

User avatar
kimausoleil
Posts: 48
Joined: 10 Nov 2010, 12:12
Location: FRANCE

31 Dec 2010, 08:48

There is an example in showcase. I think this can help you :

http://www.primefaces.org/showcase/ui/dialogLogin.jsf
JSF2 - Glassfish 3.0.1 - Mojarra 2.0.4 - PrimeFaces 2.2.1 - Netbeans 6.9.1

unixlibre
Posts: 7
Joined: 31 Dec 2010, 03:14

31 Dec 2010, 19:46

There is an example in showcase. I think this can help you :

http://www.primefaces.org/showcase/ui/dialogLogin.jsf


Thank you, I'll check it.

Best regards,

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests