-
1. Re: State management problem
ilya_shaikovsky Jul 29, 2009 4:15 AM (in response to quartilan)http://www.jboss.org/index.html?module=bb&op=viewtopic&t=143863 - anout design forum.
and show the code. -
2. Re: State management problem
quartilan Jul 29, 2009 4:38 AM (in response to quartilan)This is the code where I use my tabs.
<rich:tabPanel id="tabs" switchType="client" > <c:forEach var="i" begin="0" end="#{navigationBean.numberOfTabs}" step="1" varStatus="status"> <rich:tab name="tab#{status.index}"> <f:facet name="label"> <h:panelGrid columns="2"> <h:outputText value="#{navigationBean.tabs[status.index].label}" /> <h:graphicImage value="/images/closeicon.gif" style="width:12px; height:12px;" onclick="closeTab('#{status.index}'); Event.stop(event);"/> </h:panelGrid> </f:facet> <a4j:include keepTransient="false" viewId="#{navigationBean.tabs[status.index].path}" layout="block" /> </rich:tab> </c:forEach> </rich:tabPanel>
The navigationBean holds an array of Objects where the path to inlcude and the label is stored.
This is the code where I remove my 'tab'. When this is done the tabPanel is rerendered.public void removeTab() { this.tabs.remove(activeTabIndex); numberOfTabs--; if (activeTabIndex == 0) { makeActiveTab(0); } else { makeActiveTab(activeTabIndex - 1); } nextTabIndex--; }
If you need more information please ask me. I really could use the help.
Thx -
3. Re: State management problem
quartilan Jul 29, 2009 4:39 AM (in response to quartilan)And sorry about the misplacement of the other post.
Don't know how I could have missed the topic on posting. -
4. Re: State management problem
alexsmirnov Jul 31, 2009 12:57 AM (in response to quartilan)What is your navigation bean scope ?
The keepAlive component suppose to work with request-scope bean. JSF framework instantiates that bean on the first request and that instance stored in the view tree. For subsequent request bean instance will be restored from view and takes place of the bean.
Because JSF does not restore view state for non-post request, you will have a new navigationBean instance for request from a new tab ( even simple 'refresh' page request should reset that bean.
a4j:keepAlive component has a very limited functionality. For a more powerful solution, take look on Jboss Seam framework and its 'conversation' scope. -
5. Re: State management problem
quartilan Jul 31, 2009 9:32 AM (in response to quartilan)Thx for you reply.
My NavigationBean is session scoped. Because the count and such for my tabs must be kept.
My keepAlive is put on the pages that are loaded in the a4j:include.
My problem lays in the fact that I need a way to clean the beans for my included pages when I close a tab.
I know what pages / beans are loaded in a tab so that is not a problem. I just can't get them out of the view tree.
I have looked at seam and I believe this could be an option but I may not use it in this project. (stupid/ignorant project managers) ;-) -
6. Re: State management problem
quartilan Aug 5, 2009 3:16 AM (in response to quartilan)I have not yet found a solution for this problem so any help would be greatly appreciated.
Thx -
7. Re: State management problem
ilya_shaikovsky Aug 5, 2009 3:59 AM (in response to quartilan)In one of the Max articles http://java.dzone.com/articles/jboss-richfaces-spring?page=0,5 reseting kept alive bean defined well as
FacesContext.getCurrentInstance().getExternalContext().getRequestMap() .remove("wizardBean");