-
1. Re: Switching instance of backing bean of JSF page with Seam
damianharvey Nov 8, 2007 2:51 PM (in response to tim_ph)Have you tried outjecting both copies into the Conversation context and then just referencing them in the Bean backing the next page?
eg:@Out(ScopeType.CONVERSATION) Bean oldBean; @Out(ScopeType.CONVERSATION) Bean newBean;
Cheers,
Damian. -
2. Re: Switching instance of backing bean of JSF page with Seam
tim_ph Nov 8, 2007 3:21 PM (in response to tim_ph)Well, I use one page with backing bean in Seam Framework.
- page.xml set id, which backing object Home use to load up the instance from DB
- page.xhtml get loaded with instance populated
- one page for view, one for edit
I try to switch old bean with new one as in objHome.setInstance() and setId(), but that won't work because when you set the view page on s:button with no id, it just uses current id for the next page. So, when the page is loaded, old instance populates the page.
Just thinking about using navigation from-action in page.xml like this<navigation from-action="#{applicationHome.manager.action}"> <rule if-outcome="success"> <redirect view-id="Application.xhtml"> <param name="applicationId" value="#{applicationHome.instance.id}"/> </redirect> </rule> </navigation> If redirect populate #{applicationHome.instance.id} after action is done, then it will work. If not, current id will populate that, and we're back to square one. Let me give it a try.
-
3. Re: Switching instance of backing bean of JSF page with Seam
tim_ph Nov 8, 2007 4:34 PM (in response to tim_ph)It's very sticky.
After setting id to new object and return "success" from method action, the URL is showing applicationId = new application ID, but the instance on the page is still the same old one! Arghhh...Long id = newclone.getId(); applicationHome.setId(id); applicationHome.setInstance(newclone); return "success";