PrimeFaces Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Introducing dialog framework

PrimeFaces 4.0 introduces a new dialog framework, which can be used to generate dynamic dialog components at runtime with the content from any external facelets page.

In order to use a dialog framework, first we need to configure DialogActionListener, DialogNavigationHandler, and DialogViewHandler in faces-config.xml as follows:

<faces-config ...>
  <application>
    <action-listener>
 org.primefaces.application.DialogActionListener
 </action-listener>
 <navigation-handler>
 org.primefaces.application.DialogNavigationHandler
 </navigation-handler>
 <view-handler>
 org.primefaces.application.DialogViewHandler
 </view-handler>
  </application>
</faces-config>

We can use the RequestContext.openDialog() and RequestContext.closeDialog() methods to open and close the dialog components.