• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to show dialog in JSF 2.0 without using any faces(primefaces, icefaces, richfaces)  RSS feed

 
Surodip Patra
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me how can I display a modal dialog in JSF 2.0 without using any faces like primefaces, icefaces...

Thanks,
Surodip Patra
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're using "faces". JavaServer Faces. But I'm sure that what you meant was not using any third-party add-ons to the core JSF.

The actual implementation of most of these third-party dialogs uses CSS magic and 2 divs. One div overlays the entire page, thus blocking input to the controls on the base page while the dialog is displayed. The other div contains the dialog box, and is in turn overlaid on to of the full-page div. Within the dialog-box div an ordinary JSF form is operating using AJAX (otherwise the entire page gets replaced when you submit dialog data!)


All of this is set up in advance when the page is initially displayed, but the Z-order of the divs places the dialog divs behind the primary page so that they are hidden by the primary page. To display the dialog, a simple javascript function re-arranges the Z-order to push the dialog divs ahead of the primary page content. To dismiss the dialog, you undo this.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!