• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Modal Panel from backing bean

 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone know how to display a modal panel using richfaces 3 from a backing bean. I can do modal window from user clicking a button but how do I display it from backing bean
On my page, I have a text field and ok button, user enter some number and send this number to backing bean, if some condition is met, than modal panel displays.
I thought about using HtmlComponentControl but no luck, here is code snippet



nothing happened

Any suggestion is greatly greatly appreciated
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A modal panel is normally not controlled by the backing bean for the simple reason that J2EE/HTTP is not asynchronous (AJAX) is only "fake-asynchronous"), so there's no way a server-side bean could just up and decide to show or hide a dialog.

So the more common case is to do that using JavaScript on the View itself, usually from an "onclick" of a button or link, as illustrated by the RichFaces Live Demo.
 
Davie Lin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank Tim for providing the reason. I have decide to do a redirect to a different page if the condition is met. However, if not using backing bean to call a pop-up directly, is it possible to call javascrip functions that creates a pop-up ( maybe a modal panel ) from the backing bean?

Thanks again
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using RichFaces, you define the dialog as part of the page View definition. It has to be in a separate form from the rest of the page, and any backing bean references in it are going to reflect the values from when the page was loaded, so if you want to do things on the page and have those changes reflected in the dialog, you should reRender the dialog before making it visible.

The RichFaces ModalPanel isn't something that JavaScript can create "on the fly", because it requires JSF resources. So it's pre-defined and shown/hidden on command.

For an actual JavaScript-defined dynamic dialog, you'd be talking a lot of delicate work, so a framework like jQuery or dojo would be advisable. RichFaces includes jQuery automatically (it uses it internally), but it's a fairly old version of jQuery.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic