Rafael Nami wrote:
> Good afternoon everyone.
> Our team is having doubts about a usecase needed in our app.
> We have a page, that calls a popup that searches some stuff to add,
> and adds this stuff to the parent page. The parent page have to be
> responsible to save everything. What is the best practice?
> Put the entire backing bean in session scope? Use x:saveState in both
> parent and popup pages to save the backing bean?
> 
Best practice is not to use popups at all, you might run into loads
of trouble that way, the problem with popups is, there
is no dedicated modal dialog mechanism in browsers, I once
tried a solution which worked on Mozilla (setting the window into the front)
which caused me to lose focus in IE.

The best approach to this issue so far is the one jenia4faces uses
by simulating modal popups with iframes.
That way you are pretty safe of all issues related to popups (double window
problem, pending not closed popups etc...).

As for the rest, using saveState for state saving in the parent and the popup 
works
fine, or at least should (I had such a situation once, where I could not use it
due to heavy ajax usage outside of the jsf scope)

Also you might check out various dialog systems like seam (seam seems to be 
tailored
exactly for such a situation) or shale dialog.

---
As for your stuff, you basically describe a classical master detail problem...
the last time I solved it by using a popup (I should beat myself for that) for 
the input
which dumped the thing into the session (savestate did not work due to heavy 
ajaxing)
and then I was rerendering the master part of the form with an ajax request
on html level, but believe me implementing this is not a walk in the park
it did cost me almost two days fighting as usual with IE most of the time until 
it ran
to a satisfying degree.
If I had more time I probbably would have opted for a cleaner solution than I 
did.



Reply via email to