Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Conditionally displaying pop-up based on results of jsf processing. Possible?  RSS feed

 
Eli Wood
Ranch Hand
Posts: 37
Oracle Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Long story but I'll keep it short: I'd like to display the results of some processing by my managed beans in a data table in a pop-up window.

I can't reload or navigate away from the main page, and I'd rather not clutter the main page with panels or frames for displaying results.

So basically I need to be able to conditionally execute some javascript based on the status of my managed bean once it has completed the jsf lifecycle. Is this possible? Could this be accomplished with j4fry, if it's too complicated for an elegant solution otherwise?
[ October 27, 2008: Message edited by: Eli Wood ]
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Short answer: yes.

The secret is to understand that a managed bean is no different than any other sort of JavaBean used by a webapp - aside from the fact that the JSF framework has been told to construct it (and how to initialize it).

So look at it from the same point of view as you would any other sort of request for a JSF page plus targeting the URL to display in a pop-up window.
 
Eli Wood
Ranch Hand
Posts: 37
Oracle Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, but I need these results to be posted back to the main page as well, though. Some graphics on the main page will be updated based on these results. So just making the target a pop-up will mess up my rendering, I believe.

Just looking for a way to execute some client-side code on the main page that inspects the properties of my bean after the response and conditionally creates a pop-up.

I could see being able to do this if my page was written as a servlet so I had access to the doPost method (not sure exactly how this would work, but it seems like it'd be realistically possible), but my main page is pretty big with several taglibs so I don't think I could easily convert it to a servlet.

Another option I'd thought of was having a polling javascript function that sleeps for half a second or so, wakes up, checks the DOM for a hidden text field I update through my jsf bean, and conditionally launches a pop-up which references the same jsf bean. This seems sloppy and I'm not sure how easy it'd be to write this kind of js.

Any ideas?
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Eli Wood:
Thanks, but I need these results to be posted back to the main page as well, though. Some graphics on the main page will be updated based on these results. So just making the target a pop-up will mess up my rendering, I believe.

Just looking for a way to execute some client-side code on the main page that inspects the properties of my bean after the response and conditionally creates a pop-up.

I could see being able to do this if my page was written as a servlet so I had access to the doPost method (not sure exactly how this would work, but it seems like it'd be realistically possible), but my main page is pretty big with several taglibs so I don't think I could easily convert it to a servlet.

Another option I'd thought of was having a polling javascript function that sleeps for half a second or so, wakes up, checks the DOM for a hidden text field I update through my jsf bean, and conditionally launches a pop-up which references the same jsf bean. This seems sloppy and I'm not sure how easy it'd be to write this kind of js.

Any ideas?
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the wrong 'quote' post, you can tell I am a new rancher!

Well, for the pop up window, you can display the results in a new window and after closing that pop up refresh your main page. I was trying that a couple days ago,but that did not turn out pretty well as I had to do some processing from the pop window too,but if you just have to show the results then have a command button and use javascript onclick event to refresh parent window and c
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!