O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – showing the search users screen in dialog

Let us see how we can display the search users page (searchUsers.xhtml) in the Dialog component.

  1. Create a CommandButton button whose actionListener triggers open the dialog using the RequestContext.openDialog() method:
    <p:commandButton value="Search Users" actionListener="#{userController.searchUsersForm}" />  
    
    public void searchUsersForm() 
    {
      RequestContext.getCurrentInstance().openDialog("searchUsers");
    }
  2. Create the search users page searchUsers.xhtml as follows:
    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <h:head> <title>Search ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required