display the dialog box after checking a condition at server

UI Components for JSF
Post Reply
girishkumar
Posts: 4
Joined: 24 Jun 2011, 14:55

12 Sep 2011, 13:07

hw to display the dialog box after checking a condition at server side,
here dialog box is displaying directly ......need support
thank you

felix@componio
Posts: 4
Joined: 19 May 2011, 10:04

12 Sep 2011, 13:14

Hi,

a little code snippet would be usefull.

Code: Select all

<p:commandButton action="#{yourBean.checkMyCondition}" update="mydialog" />

<h:panelGroup id="mydialog">
<p:dialog rendered=#{yourBean.conditionFlag}>
// content
</p:dialog>
</h:panelGroup>
YourBean.java

Code: Select all

private boolean conditionFlag;


public void checkMyCondition() {
 this.conditionFlag = (weather.equals("sunny")) ? true : false;
}

// public getter and setter for conditionFlag
...
rendered="" checks for a boolean.

you also can open the dialog with a javascript. check http://www.primefaces.org/showcase-labs/ui/dialog.jsf for examples

Felix

girishkumar
Posts: 4
Joined: 24 Jun 2011, 14:55

12 Sep 2011, 14:31

already i worked with ur suggested scenario
My.xhtml::

Code: Select all

<p:panel id="mypanel">
<p:dialog message="Version already exists. Do you want to override it?"
                                  modal="true" fixedCenter="true" rendered="#{bean.Flag}"
         widgetVar="confirmation">
        <!-- Some Logic-->
     </p:dialog>
</p:panel>
The dialog is displaying only when i call "confirmation.show()" for a button
But when i used render property not displaying the dialog where i am changing the flag value
Irrespective of the render value it is displaying the dialog
(Note : Here i am updating the panel when action performed)

thanks for reply

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 43 guests