Adding component dialog using java code a JSF page

UI Components for JSF
Post Reply
trafalgar
Posts: 10
Joined: 24 Feb 2011, 00:30

24 Feb 2011, 07:14

I have a ManagedBean where there is the following method that invoked by a ActionListener:

Code: Select all


import org.primefaces.component.dialog.Dialog;

public void metodo(ActionEvent event) throws IOException{
		FacesContext context = FacesContext.getCurrentInstance();
		Dialog aviso = (Dialog) context.getViewRoot().findComponent("id");
		aviso.setVisible(true);
		aviso.encodeBegin(context);
		aviso.encodeEnd(context);
	}
With it I intend to make visible a dialog component in a JSF page. The component dialog in the page is so:

Code: Select all

<p:dialod id="id">
//Codigo
</p:dialog>
I wonder if you can create a method that is invoked by an ActionListener to add an object Dialog to a JSF page.

thanks in advance
Last edited by trafalgar on 25 Feb 2011, 18:51, edited 1 time in total.

trafalgar
Posts: 10
Joined: 24 Feb 2011, 00:30

25 Feb 2011, 15:45

Please I need urgent

User avatar
ydarcin
Posts: 258
Joined: 04 Jan 2009, 19:02
Location: Turkey

25 Feb 2011, 16:08

Hi,

if you check the showcase:

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

you can do it either in oncomplete method of a p:command* or use js with dialogVar.show();

Yigit.

trafalgar
Posts: 10
Joined: 24 Feb 2011, 00:30

25 Feb 2011, 18:50

You see I need to do some validation in that method and accordingly display a dialog window (Dialog Object of primefaces)

So wanted to know how you could add a object Dialog, using java code, to a jsf page

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests